| 236 |
235 |
| 237 /* Main dialog */ |
236 /* Main dialog */ |
| 238 static PidginPrefsWindow *prefs = NULL; |
237 static PidginPrefsWindow *prefs = NULL; |
| 239 |
238 |
| 240 /* Themes page */ |
239 /* Themes page */ |
| 241 static GtkWidget *prefs_blist_themes_combo_box; |
|
| 242 static GtkWidget *prefs_status_themes_combo_box; |
240 static GtkWidget *prefs_status_themes_combo_box; |
| 243 static GtkWidget *prefs_smiley_themes_combo_box; |
241 static GtkWidget *prefs_smiley_themes_combo_box; |
| 244 |
242 |
| 245 /* These exist outside the lifetime of the prefs dialog */ |
243 /* These exist outside the lifetime of the prefs dialog */ |
| 246 static GtkListStore *prefs_blist_themes; |
|
| 247 static GtkListStore *prefs_status_icon_themes; |
244 static GtkListStore *prefs_status_icon_themes; |
| 248 static GtkListStore *prefs_smiley_themes; |
245 static GtkListStore *prefs_smiley_themes; |
| 249 |
246 |
| 250 /* |
247 /* |
| 251 * PROTOTYPES |
248 * PROTOTYPES |
| 850 |
847 |
| 851 /* Unregister callbacks. */ |
848 /* Unregister callbacks. */ |
| 852 purple_prefs_disconnect_by_handle(prefs); |
849 purple_prefs_disconnect_by_handle(prefs); |
| 853 |
850 |
| 854 /* NULL-ify globals */ |
851 /* NULL-ify globals */ |
| 855 prefs_blist_themes_combo_box = NULL; |
|
| 856 prefs_status_themes_combo_box = NULL; |
852 prefs_status_themes_combo_box = NULL; |
| 857 prefs_smiley_themes_combo_box = NULL; |
853 prefs_smiley_themes_combo_box = NULL; |
| 858 |
854 |
| 859 keyring_page_cleanup(prefs); |
855 keyring_page_cleanup(prefs); |
| 860 |
856 |
| 913 GdkPixbuf *pixbuf = NULL; |
909 GdkPixbuf *pixbuf = NULL; |
| 914 GtkTreeIter iter; |
910 GtkTreeIter iter; |
| 915 gchar *image_full = NULL, *markup; |
911 gchar *image_full = NULL, *markup; |
| 916 const gchar *name, *author, *description; |
912 const gchar *name, *author, *description; |
| 917 |
913 |
| 918 if (PIDGIN_IS_BLIST_THEME(theme) || PIDGIN_IS_STATUS_ICON_THEME(theme)){ |
914 if (PIDGIN_IS_STATUS_ICON_THEME(theme)){ |
| 919 GtkListStore *store; |
915 GtkListStore *store; |
| 920 |
916 |
| 921 if (PIDGIN_IS_BLIST_THEME(theme)) |
917 store = prefs_status_icon_themes; |
| 922 store = prefs_blist_themes; |
|
| 923 else |
|
| 924 store = prefs_status_icon_themes; |
|
| 925 |
918 |
| 926 image_full = purple_theme_get_image_full(theme); |
919 image_full = purple_theme_get_image_full(theme); |
| 927 if (image_full != NULL){ |
920 if (image_full != NULL){ |
| 928 pixbuf = pidgin_pixbuf_new_from_file_at_scale(image_full, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE); |
921 pixbuf = pidgin_pixbuf_new_from_file_at_scale(image_full, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE); |
| 929 g_free(image_full); |
922 g_free(image_full); |
| 981 purple_theme_manager_refresh(); |
974 purple_theme_manager_refresh(); |
| 982 |
975 |
| 983 tmp = g_build_filename(PURPLE_DATADIR, "icons", "hicolor", "32x32", |
976 tmp = g_build_filename(PURPLE_DATADIR, "icons", "hicolor", "32x32", |
| 984 "apps", "im.pidgin.Pidgin3.png", NULL); |
977 "apps", "im.pidgin.Pidgin3.png", NULL); |
| 985 pixbuf = pidgin_pixbuf_new_from_file_at_scale(tmp, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE); |
978 pixbuf = pidgin_pixbuf_new_from_file_at_scale(tmp, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE); |
| 986 g_free(tmp); |
|
| 987 |
|
| 988 /* blist themes */ |
|
| 989 gtk_list_store_clear(prefs_blist_themes); |
|
| 990 gtk_list_store_append(prefs_blist_themes, &iter); |
|
| 991 tmp = get_theme_markup(_("Default"), FALSE, _("Penguin Pimps"), |
|
| 992 _("The default Pidgin buddy list theme")); |
|
| 993 gtk_list_store_set(prefs_blist_themes, &iter, 0, pixbuf, 1, tmp, 2, "", -1); |
|
| 994 g_free(tmp); |
979 g_free(tmp); |
| 995 |
980 |
| 996 /* status icon themes */ |
981 /* status icon themes */ |
| 997 gtk_list_store_clear(prefs_status_icon_themes); |
982 gtk_list_store_clear(prefs_status_icon_themes); |
| 998 gtk_list_store_append(prefs_status_icon_themes, &iter); |
983 gtk_list_store_append(prefs_status_icon_themes, &iter); |
| 1008 |
993 |
| 1009 purple_theme_manager_for_each_theme(prefs_themes_sort); |
994 purple_theme_manager_for_each_theme(prefs_themes_sort); |
| 1010 smileys_refresh_theme_list(); |
995 smileys_refresh_theme_list(); |
| 1011 |
996 |
| 1012 /* set active */ |
997 /* set active */ |
| 1013 prefs_set_active_theme_combo(prefs_blist_themes_combo_box, prefs_blist_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme")); |
|
| 1014 prefs_set_active_theme_combo(prefs_status_themes_combo_box, prefs_status_icon_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/status/icon-theme")); |
998 prefs_set_active_theme_combo(prefs_status_themes_combo_box, prefs_status_icon_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/status/icon-theme")); |
| 1015 prefs_set_active_theme_combo(prefs_smiley_themes_combo_box, prefs_smiley_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/smileys/theme")); |
999 prefs_set_active_theme_combo(prefs_smiley_themes_combo_box, prefs_smiley_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/smileys/theme")); |
| 1016 } |
1000 } |
| 1017 |
1001 |
| 1018 /* init all the theme variables so that the themes can be sorted later and used by pref pages */ |
1002 /* init all the theme variables so that the themes can be sorted later and used by pref pages */ |
| 1019 static void |
1003 static void |
| 1020 prefs_themes_init(void) |
1004 prefs_themes_init(void) |
| 1021 { |
1005 { |
| 1022 prefs_blist_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); |
|
| 1023 |
|
| 1024 prefs_status_icon_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); |
1006 prefs_status_icon_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); |
| 1025 |
1007 |
| 1026 prefs_smiley_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); |
1008 prefs_smiley_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); |
| 1027 } |
1009 } |
| 1028 |
1010 |
| 1429 g_free(name2); |
1411 g_free(name2); |
| 1430 |
1412 |
| 1431 return ret; |
1413 return ret; |
| 1432 } |
1414 } |
| 1433 |
1415 |
| 1434 /* sets the current buddy list theme */ |
|
| 1435 static void |
|
| 1436 prefs_set_blist_theme_cb(GtkComboBox *combo_box, gpointer user_data) |
|
| 1437 { |
|
| 1438 PidginBlistTheme *theme = NULL; |
|
| 1439 GtkTreeIter iter; |
|
| 1440 gchar *name = NULL; |
|
| 1441 |
|
| 1442 if(gtk_combo_box_get_active_iter(combo_box, &iter)) { |
|
| 1443 |
|
| 1444 gtk_tree_model_get(GTK_TREE_MODEL(prefs_blist_themes), &iter, 2, &name, -1); |
|
| 1445 |
|
| 1446 if(!name || *name) |
|
| 1447 theme = PIDGIN_BLIST_THEME(purple_theme_manager_find_theme(name, "blist")); |
|
| 1448 |
|
| 1449 g_free(name); |
|
| 1450 |
|
| 1451 pidgin_blist_set_theme(theme); |
|
| 1452 } |
|
| 1453 } |
|
| 1454 |
|
| 1455 /* sets the current icon theme */ |
1416 /* sets the current icon theme */ |
| 1456 static void |
1417 static void |
| 1457 prefs_set_status_icon_theme_cb(GtkComboBox *combo_box, gpointer user_data) |
1418 prefs_set_status_icon_theme_cb(GtkComboBox *combo_box, gpointer user_data) |
| 1458 { |
1419 { |
| 1459 PidginStatusIconTheme *theme = NULL; |
1420 PidginStatusIconTheme *theme = NULL; |
| 1475 } |
1436 } |
| 1476 |
1437 |
| 1477 static void |
1438 static void |
| 1478 bind_theme_page(PidginPrefsWindow *win) |
1439 bind_theme_page(PidginPrefsWindow *win) |
| 1479 { |
1440 { |
| 1480 /* Buddy List Themes */ |
|
| 1481 prefs_build_theme_combo_box(win->theme.blist, prefs_blist_themes, |
|
| 1482 PIDGIN_PREFS_ROOT "/blist/theme", "blist"); |
|
| 1483 prefs_blist_themes_combo_box = win->theme.blist; |
|
| 1484 |
|
| 1485 /* Status Icon Themes */ |
1441 /* Status Icon Themes */ |
| 1486 prefs_build_theme_combo_box(win->theme.status, prefs_status_icon_themes, |
1442 prefs_build_theme_combo_box(win->theme.status, prefs_status_icon_themes, |
| 1487 PIDGIN_PREFS_ROOT "/status/icon-theme", |
1443 PIDGIN_PREFS_ROOT "/status/icon-theme", |
| 1488 "icon"); |
1444 "icon"); |
| 1489 prefs_status_themes_combo_box = win->theme.status; |
1445 prefs_status_themes_combo_box = win->theme.status; |
| 2969 gtk_widget_class_bind_template_child( |
2925 gtk_widget_class_bind_template_child( |
| 2970 widget_class, PidginPrefsWindow, away.startup_label); |
2926 widget_class, PidginPrefsWindow, away.startup_label); |
| 2971 |
2927 |
| 2972 /* Themes page */ |
2928 /* Themes page */ |
| 2973 gtk_widget_class_bind_template_child( |
2929 gtk_widget_class_bind_template_child( |
| 2974 widget_class, PidginPrefsWindow, theme.blist); |
|
| 2975 gtk_widget_class_bind_template_child( |
|
| 2976 widget_class, PidginPrefsWindow, theme.status); |
2930 widget_class, PidginPrefsWindow, theme.status); |
| 2977 gtk_widget_class_bind_template_child( |
2931 gtk_widget_class_bind_template_child( |
| 2978 widget_class, PidginPrefsWindow, theme.smiley); |
2932 widget_class, PidginPrefsWindow, theme.smiley); |
| 2979 gtk_widget_class_bind_template_callback(widget_class, |
|
| 2980 prefs_set_blist_theme_cb); |
|
| 2981 gtk_widget_class_bind_template_callback(widget_class, |
2933 gtk_widget_class_bind_template_callback(widget_class, |
| 2982 prefs_set_status_icon_theme_cb); |
2934 prefs_set_status_icon_theme_cb); |
| 2983 gtk_widget_class_bind_template_callback(widget_class, |
2935 gtk_widget_class_bind_template_callback(widget_class, |
| 2984 prefs_set_smiley_theme_cb); |
2936 prefs_set_smiley_theme_cb); |
| 2985 } |
2937 } |