/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 2003-2009 Hiroyuki Yamamoto & the Claws Mail team
+ * Copyright (C) 2003-2012 Hiroyuki Yamamoto & the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "mainwindow.h"
#include "compose.h"
#include "alertpanel.h"
+#include "addr_compl.h"
#define IS_CURRENT_THEME(path) (strcmp(prefs_common.pixmap_theme_path, path) == 0)
#define IS_INTERNAL_THEME(path) (strcmp(DEFAULT_PIXMAP_THEME, path) == 0)
struct dirent *d;
DIR *dp;
- g_return_if_fail(dirname != NULL);
- g_return_if_fail(func != NULL);
+ cm_return_if_fail(dirname != NULL);
+ cm_return_if_fail(func != NULL);
if ((dp = opendir(dirname)) == NULL) {
debug_print("directory %s not found\n", dirname);
gchar *system_theme_dir;
gboolean is_sys = FALSE;
- g_return_val_if_fail(dirname != NULL, FALSE);
+ cm_return_val_if_fail(dirname != NULL, FALSE);
system_theme_dir = stock_pixmap_get_system_theme_dir_for_theme(NULL);
len = strlen(system_theme_dir);
gint i = 0, active = 0;
GList *sorted_list = NULL;
- g_return_if_fail(combo != NULL);
+ cm_return_if_fail(combo != NULL);
/* sort theme data list by data name */
while (themes != NULL) {
{
GList *tpaths;
- g_return_if_fail(tdata != NULL);
+ cm_return_if_fail(tdata != NULL);
if (tdata->themes != NULL)
stock_pixmap_themes_list_free(tdata->themes);
names = g_list_next(names);
}
- g_list_free(names);
+ g_list_free(tdata->names);
tdata->names = NULL;
}
gchar *theme_str;
theme_str = tdata->displayed;
-
+
g_free(prefs_common.pixmap_theme_path);
-
+
prefs_common.pixmap_theme_path = g_strdup(theme_str);
-
+
main_window_reflect_prefs_all_real(TRUE);
compose_reflect_prefs_pixmap_theme();
-
+ addrcompl_reflect_prefs_pixmap_theme();
+
prefs_themes_update_buttons(tdata);
}
GtkTreeModel *model;
GtkTreeIter iter;
- g_return_if_fail(gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter));
+ cm_return_if_fail(gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter));
model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
gtk_tree_model_get(model, &iter, 1, &path, -1);
#define FGETS_INFOFILE_LINE() \
line[0] = '\0'; \
- fgets(line, INFOFILE_LINE_LEN, finfo); \
- if ((len = strlen(line)) > 0) { \
+ if (fgets(line, INFOFILE_LINE_LEN, finfo) != NULL && (len = strlen(line)) > 0) { \
if (line[len - 1] == '\n') line[len - 1] = '\0'; \
} \
else { \
ThemeInfo *info;
ThemesPage *theme = tdata->page;
- g_return_if_fail(theme != NULL);
+ cm_return_if_fail(theme != NULL);
path = tdata->displayed;
- g_return_if_fail(path != NULL);
+ cm_return_if_fail(path != NULL);
debug_print("Getting theme info for %s\n", path);
return stats;
}
-/* BEGIN GLADE CODE */
-/* This is a dummy pixmap we use when a pixmap can't be found. */
-static char *dummy_pixmap_xpm[] = {
- /* columns rows colors chars-per-pixel */
- "1 1 1 1",
- " c None",
- /* pixels */
- " "
-};
-
-/* This is an internally used function to create pixmaps. */
-static GtkWidget* create_dummy_pixmap(GtkWidget *widget)
-{
- GdkColormap *colormap;
- GdkPixmap *gdkpixmap;
- GdkBitmap *mask;
- GtkWidget *pixmap;
-
- colormap = gtk_widget_get_colormap (widget);
- gdkpixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &mask,
- NULL, dummy_pixmap_xpm);
- if (gdkpixmap == NULL)
- g_error ("Couldn't create replacement pixmap.");
- pixmap = gtk_image_new_from_pixmap(gdkpixmap, mask);
- g_object_unref (gdkpixmap);
- g_object_unref (mask);
- return pixmap;
-}
-/* END GLADE CODE */
-
-/* glade generates some calls to a create_pixmap support function
- * we don't really need. */
-#define create_pixmap(widget,filename) create_dummy_pixmap(widget)
-
static void prefs_themes_create_widget(PrefsPage *page, GtkWindow *window, gpointer data)
{
ThemesPage *prefs_themes = (ThemesPage *)page;
btn_install = gtk_button_new_with_label (_("Install new..."));
gtk_widget_show (btn_install);
gtk_box_pack_start (GTK_BOX (hbox3), btn_install, FALSE, FALSE, 0);
- GTK_WIDGET_SET_FLAGS (btn_install, GTK_CAN_DEFAULT);
+ gtkut_widget_set_can_default (btn_install, TRUE);
btn_more = gtkut_get_link_btn((GtkWidget *)window, THEMES_URI, _("Get more..."));
gtk_widget_show (btn_more);
gtk_widget_show (hbox1);
gtk_container_add (GTK_CONTAINER (frame_preview), hbox1);
- icon_1 = create_pixmap (vbox1, NULL);
+ icon_1 = gtk_image_new();
gtk_widget_show (icon_1);
gtk_box_pack_start (GTK_BOX (hbox1), icon_1, TRUE, TRUE, 2);
gtk_misc_set_padding (GTK_MISC (icon_1), 0, 5);
- icon_2 = create_pixmap (vbox1, NULL);
+ icon_2 = gtk_image_new();
gtk_widget_show (icon_2);
gtk_box_pack_start (GTK_BOX (hbox1), icon_2, TRUE, TRUE, 2);
gtk_misc_set_padding (GTK_MISC (icon_2), 0, 5);
- icon_3 = create_pixmap (vbox1, NULL);
+ icon_3 = gtk_image_new();
gtk_widget_show (icon_3);
gtk_box_pack_start (GTK_BOX (hbox1), icon_3, TRUE, TRUE, 2);
gtk_misc_set_padding (GTK_MISC (icon_3), 0, 5);
- icon_4 = create_pixmap (vbox1, NULL);
+ icon_4 = gtk_image_new();
gtk_widget_show (icon_4);
gtk_box_pack_start (GTK_BOX (hbox1), icon_4, TRUE, TRUE, 2);
gtk_misc_set_padding (GTK_MISC (icon_4), 0, 5);
- icon_5 = create_pixmap (vbox1, NULL);
+ icon_5 = gtk_image_new();
gtk_widget_show (icon_5);
gtk_box_pack_start (GTK_BOX (hbox1), icon_5, TRUE, TRUE, 2);
gtk_misc_set_padding (GTK_MISC (icon_5), 0, 5);
- icon_6 = create_pixmap (vbox1, NULL);
+ icon_6 = gtk_image_new();
gtk_widget_show (icon_6);
gtk_box_pack_start (GTK_BOX (hbox1), icon_6, TRUE, TRUE, 0);
gtk_misc_set_padding (GTK_MISC (icon_6), 0, 5);
- icon_7 = create_pixmap (vbox1, NULL);
+ icon_7 = gtk_image_new();
gtk_widget_show (icon_7);
gtk_box_pack_start (GTK_BOX (hbox1), icon_7, TRUE, TRUE, 0);
gtk_misc_set_padding (GTK_MISC (icon_7), 0, 5);
btn_use = gtk_button_new_with_label (_("Use this"));
gtk_widget_show (btn_use);
gtk_container_add (GTK_CONTAINER (hbuttonbox1), btn_use);
- GTK_WIDGET_SET_FLAGS (btn_use, GTK_CAN_DEFAULT);
+ gtkut_widget_set_can_default (btn_use, TRUE);
btn_remove = gtk_button_new_with_label (_("Remove"));
gtk_widget_show (btn_remove);
gtk_container_add (GTK_CONTAINER (hbuttonbox1), btn_remove);
- GTK_WIDGET_SET_FLAGS (btn_remove, GTK_CAN_DEFAULT);
+ gtkut_widget_set_can_default (btn_remove, TRUE);
g_signal_connect(G_OBJECT(btn_use), "clicked",
G_CALLBACK(prefs_themes_btn_use_clicked_cb),