| 72 |
72 |
| 73 static int sound_row_sel = 0; |
73 static int sound_row_sel = 0; |
| 74 static GtkWidget *prefsnotebook; |
74 static GtkWidget *prefsnotebook; |
| 75 |
75 |
| 76 static GtkWidget *sound_entry = NULL; |
76 static GtkWidget *sound_entry = NULL; |
| 77 static GtkListStore *smiley_theme_store = NULL; |
|
| 78 static GtkTreeSelection *smiley_theme_sel = NULL; |
|
| 79 static GtkWidget *prefs_proxy_frame = NULL; |
77 static GtkWidget *prefs_proxy_frame = NULL; |
| 80 static GtkWidget *prefs_proxy_subframe = NULL; |
78 static GtkWidget *prefs_proxy_subframe = NULL; |
| 81 |
79 |
| 82 static GtkWidget *prefs = NULL; |
80 static GtkWidget *prefs = NULL; |
| 83 static GtkWidget *debugbutton = NULL; |
81 static GtkWidget *debugbutton = NULL; |
| 84 static int notebook_page = 0; |
82 static int notebook_page = 0; |
| 85 static GtkTreeRowReference *previous_smiley_row = NULL; |
|
| 86 |
83 |
| 87 static GtkListStore *prefs_sound_themes; |
84 static GtkListStore *prefs_sound_themes; |
| 88 static GtkListStore *prefs_blist_themes; |
85 static GtkListStore *prefs_blist_themes; |
| 89 static GtkListStore *prefs_status_icon_themes; |
86 static GtkListStore *prefs_status_icon_themes; |
| |
87 static GtkListStore *prefs_smiley_themes; |
| 90 |
88 |
| 91 static GtkWidget *prefs_sound_themes_combo_box; |
89 static GtkWidget *prefs_sound_themes_combo_box; |
| 92 static GtkWidget *prefs_blist_themes_combo_box; |
90 static GtkWidget *prefs_blist_themes_combo_box; |
| 93 static GtkWidget *prefs_status_themes_combo_box; |
91 static GtkWidget *prefs_status_themes_combo_box; |
| |
92 static GtkWidget *prefs_smiley_themes_combo_box; |
| 94 |
93 |
| 95 static gboolean prefs_sound_themes_loading; |
94 static gboolean prefs_sound_themes_loading; |
| 96 |
95 |
| 97 /* |
96 /* |
| 98 * PROTOTYPES |
97 * PROTOTYPES |
| 339 |
338 |
| 340 prefs = NULL; |
339 prefs = NULL; |
| 341 sound_entry = NULL; |
340 sound_entry = NULL; |
| 342 debugbutton = NULL; |
341 debugbutton = NULL; |
| 343 notebook_page = 0; |
342 notebook_page = 0; |
| 344 smiley_theme_store = NULL; |
343 } |
| 345 if (previous_smiley_row) |
344 |
| 346 gtk_tree_row_reference_free(previous_smiley_row); |
345 static void |
| 347 previous_smiley_row = NULL; |
|
| 348 |
|
| 349 } |
|
| 350 |
|
| 351 static void |
|
| 352 smiley_sel(GtkTreeSelection *sel, GtkTreeModel *model) |
|
| 353 { |
|
| 354 GtkTreeIter iter; |
|
| 355 const char *themename; |
|
| 356 char *description; |
|
| 357 GValue val; |
|
| 358 GtkTreePath *path, *oldpath; |
|
| 359 struct smiley_theme *new_theme, *old_theme; |
|
| 360 GtkWidget *remove_button = g_object_get_data(G_OBJECT(sel), "remove_button"); |
|
| 361 |
|
| 362 if (!gtk_tree_selection_get_selected(sel, &model, &iter)) { |
|
| 363 gtk_widget_set_sensitive(remove_button, FALSE); |
|
| 364 return; |
|
| 365 } |
|
| 366 |
|
| 367 old_theme = current_smiley_theme; |
|
| 368 val.g_type = 0; |
|
| 369 gtk_tree_model_get_value(model, &iter, 3, &val); |
|
| 370 path = gtk_tree_model_get_path(model, &iter); |
|
| 371 themename = g_value_get_string(&val); |
|
| 372 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/smileys/theme", themename); |
|
| 373 |
|
| 374 gtk_widget_set_sensitive(remove_button, (strcmp(themename, "none") && |
|
| 375 strcmp(themename, _("Default")))); |
|
| 376 g_value_unset (&val); |
|
| 377 |
|
| 378 /* current_smiley_theme is set in callback for the above pref change */ |
|
| 379 new_theme = current_smiley_theme; |
|
| 380 description = g_strdup_printf("<span size='larger' weight='bold'>%s</span> - %s\n" |
|
| 381 "<span size='smaller' foreground='white'>%s</span>", |
|
| 382 _(new_theme->name), _(new_theme->author), _(new_theme->desc)); |
|
| 383 gtk_list_store_set(smiley_theme_store, &iter, 1, description, -1); |
|
| 384 g_free(description); |
|
| 385 |
|
| 386 if (new_theme != old_theme && previous_smiley_row) { |
|
| 387 oldpath = gtk_tree_row_reference_get_path(previous_smiley_row); |
|
| 388 if (gtk_tree_model_get_iter(model, &iter, oldpath)) { |
|
| 389 description = g_strdup_printf("<span size='larger' weight='bold'>%s</span> - %s\n" |
|
| 390 "<span size='smaller' foreground='dim grey'>%s</span>", |
|
| 391 _(old_theme->name), _(old_theme->author), _(old_theme->desc)); |
|
| 392 gtk_list_store_set(smiley_theme_store, &iter, 1, |
|
| 393 description, -1); |
|
| 394 g_free(description); |
|
| 395 } |
|
| 396 gtk_tree_path_free(oldpath); |
|
| 397 } |
|
| 398 if (previous_smiley_row) |
|
| 399 gtk_tree_row_reference_free(previous_smiley_row); |
|
| 400 previous_smiley_row = gtk_tree_row_reference_new(model, path); |
|
| 401 gtk_tree_path_free(path); |
|
| 402 } |
|
| 403 |
|
| 404 static GtkTreeRowReference * |
|
| 405 theme_refresh_theme_list(void) |
346 theme_refresh_theme_list(void) |
| 406 { |
347 { |
| 407 GdkPixbuf *pixbuf; |
348 GdkPixbuf *pixbuf; |
| 408 GSList *themes; |
349 GSList *themes; |
| 409 GtkTreeIter iter; |
350 GtkTreeIter iter; |
| 410 GtkTreeRowReference *row_ref = NULL; |
|
| 411 |
|
| 412 if (previous_smiley_row) |
|
| 413 gtk_tree_row_reference_free(previous_smiley_row); |
|
| 414 previous_smiley_row = NULL; |
|
| 415 |
351 |
| 416 pidgin_themes_smiley_theme_probe(); |
352 pidgin_themes_smiley_theme_probe(); |
| 417 |
353 |
| 418 if (!(themes = smiley_themes)) |
354 if (!(themes = smiley_themes)) |
| 419 return NULL; |
355 return; |
| 420 |
|
| 421 gtk_list_store_clear(smiley_theme_store); |
|
| 422 |
356 |
| 423 while (themes) { |
357 while (themes) { |
| 424 struct smiley_theme *theme = themes->data; |
358 struct smiley_theme *theme = themes->data; |
| 425 char *description = g_strdup_printf("<span size='larger' weight='bold'>%s</span> - %s\n" |
359 char *description = g_strdup_printf("<span size='larger' weight='bold'>%s</span> - %s\n" |
| 426 "<span size='smaller' foreground='dim grey'>%s</span>", |
360 "<span size='smaller' foreground='dim grey'>%s</span>", |
| 427 _(theme->name), _(theme->author), _(theme->desc)); |
361 _(theme->name), _(theme->author), _(theme->desc)); |
| 428 gtk_list_store_append (smiley_theme_store, &iter); |
362 gtk_list_store_append(prefs_smiley_themes, &iter); |
| 429 |
363 |
| 430 /* |
364 /* |
| 431 * LEAK - Gentoo memprof thinks pixbuf is leaking here... but it |
365 * LEAK - Gentoo memprof thinks pixbuf is leaking here... but it |
| 432 * looks like it should be ok to me. Anyone know what's up? --Mark |
366 * looks like it should be ok to me. Anyone know what's up? --Mark |
| 433 */ |
367 */ |
| 434 pixbuf = (theme->icon ? gdk_pixbuf_new_from_file(theme->icon, NULL) : NULL); |
368 pixbuf = (theme->icon ? gdk_pixbuf_new_from_file(theme->icon, NULL) : NULL); |
| 435 |
369 |
| 436 gtk_list_store_set(smiley_theme_store, &iter, |
370 gtk_list_store_set(prefs_smiley_themes, &iter, |
| 437 0, pixbuf, |
371 0, pixbuf, |
| 438 1, description, |
372 1, description, |
| 439 2, theme->path, |
373 2, theme->name, |
| 440 3, theme->name, |
|
| 441 -1); |
374 -1); |
| 442 |
375 |
| 443 if (pixbuf != NULL) |
376 if (pixbuf != NULL) |
| 444 g_object_unref(G_OBJECT(pixbuf)); |
377 g_object_unref(G_OBJECT(pixbuf)); |
| 445 |
378 |
| 446 g_free(description); |
379 g_free(description); |
| 447 themes = themes->next; |
380 themes = themes->next; |
| 448 |
381 } |
| 449 /* If this is the currently selected theme, |
|
| 450 * we will need to select it. Grab the row reference. */ |
|
| 451 if (theme == current_smiley_theme) { |
|
| 452 GtkTreePath *path = gtk_tree_model_get_path( |
|
| 453 GTK_TREE_MODEL(smiley_theme_store), &iter); |
|
| 454 row_ref = gtk_tree_row_reference_new( |
|
| 455 GTK_TREE_MODEL(smiley_theme_store), path); |
|
| 456 gtk_tree_path_free(path); |
|
| 457 } |
|
| 458 } |
|
| 459 |
|
| 460 return row_ref; |
|
| 461 } |
382 } |
| 462 |
383 |
| 463 static gchar * |
384 static gchar * |
| 464 get_theme_markup(const char *name, gboolean custom, const char *author, |
385 get_theme_markup(const char *name, gboolean custom, const char *author, |
| 465 const char *description) |
386 const char *description) |
| 626 gtk_list_store_set(prefs_status_icon_themes, &iter, 0, pixbuf, 1, tmp, 2, "", -1); |
547 gtk_list_store_set(prefs_status_icon_themes, &iter, 0, pixbuf, 1, tmp, 2, "", -1); |
| 627 g_free(tmp); |
548 g_free(tmp); |
| 628 if (pixbuf) |
549 if (pixbuf) |
| 629 g_object_unref(G_OBJECT(pixbuf)); |
550 g_object_unref(G_OBJECT(pixbuf)); |
| 630 |
551 |
| |
552 /* smiley themes */ |
| |
553 gtk_list_store_clear(prefs_smiley_themes); |
| |
554 |
| 631 purple_theme_manager_for_each_theme(prefs_themes_sort); |
555 purple_theme_manager_for_each_theme(prefs_themes_sort); |
| 632 pref_sound_generate_markup(); |
556 pref_sound_generate_markup(); |
| |
557 theme_refresh_theme_list(); |
| 633 |
558 |
| 634 /* set active */ |
559 /* set active */ |
| 635 prefs_set_active_theme_combo(prefs_sound_themes_combo_box, prefs_sound_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme")); |
560 prefs_set_active_theme_combo(prefs_sound_themes_combo_box, prefs_sound_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme")); |
| 636 prefs_set_active_theme_combo(prefs_blist_themes_combo_box, prefs_blist_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme")); |
561 prefs_set_active_theme_combo(prefs_blist_themes_combo_box, prefs_blist_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme")); |
| 637 prefs_set_active_theme_combo(prefs_status_themes_combo_box, prefs_status_icon_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/status/icon-theme")); |
562 prefs_set_active_theme_combo(prefs_status_themes_combo_box, prefs_status_icon_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/status/icon-theme")); |
| |
563 prefs_set_active_theme_combo(prefs_smiley_themes_combo_box, prefs_smiley_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/smileys/theme")); |
| 638 prefs_sound_themes_loading = FALSE; |
564 prefs_sound_themes_loading = FALSE; |
| 639 } |
565 } |
| 640 |
566 |
| 641 /* init all the theme variables so that the themes can be sorted later and used by pref pages */ |
567 /* init all the theme variables so that the themes can be sorted later and used by pref pages */ |
| 642 static void |
568 static void |
| 1020 |
940 |
| 1021 g_free(new_theme); |
941 g_free(new_theme); |
| 1022 } |
942 } |
| 1023 } |
943 } |
| 1024 |
944 |
| |
945 /* sets the current smiley theme */ |
| |
946 static void |
| |
947 prefs_set_smiley_theme_cb(GtkComboBox *combo_box, gpointer user_data) |
| |
948 { |
| |
949 gchar *new_theme; |
| |
950 GtkTreeIter new_iter; |
| |
951 |
| |
952 if (gtk_combo_box_get_active_iter(combo_box, &new_iter)) { |
| |
953 |
| |
954 gtk_tree_model_get(GTK_TREE_MODEL(prefs_smiley_themes), &new_iter, 2, &new_theme, -1); |
| |
955 |
| |
956 purple_prefs_set_string(PIDGIN_PREFS_ROOT "/smileys/theme", new_theme); |
| |
957 |
| |
958 g_free(new_theme); |
| |
959 } |
| |
960 } |
| |
961 |
| 1025 |
962 |
| 1026 /* Does same as normal sort, except "none" is sorted first */ |
963 /* Does same as normal sort, except "none" is sorted first */ |
| 1027 static gint pidgin_sort_smileys (GtkTreeModel *model, |
964 static gint pidgin_sort_smileys (GtkTreeModel *model, |
| 1028 GtkTreeIter *a, |
965 GtkTreeIter *a, |
| 1029 GtkTreeIter *b, |
966 GtkTreeIter *b, |
| 1030 gpointer userdata) |
967 gpointer userdata) |
| 1031 { |
968 { |
| 1032 gint ret = 0; |
969 gint ret = 0; |
| 1033 gchar *name1 = NULL, *name2 = NULL; |
970 gchar *name1 = NULL, *name2 = NULL; |
| 1034 |
971 |
| 1035 gtk_tree_model_get(model, a, 3, &name1, -1); |
972 gtk_tree_model_get(model, a, 2, &name1, -1); |
| 1036 gtk_tree_model_get(model, b, 3, &name2, -1); |
973 gtk_tree_model_get(model, b, 2, &name2, -1); |
| 1037 |
974 |
| 1038 if (name1 == NULL || name2 == NULL) { |
975 if (name1 == NULL || name2 == NULL) { |
| 1039 if (!(name1 == NULL && name2 == NULL)) |
976 if (!(name1 == NULL && name2 == NULL)) |
| 1040 ret = (name1 == NULL) ? -1: 1; |
977 ret = (name1 == NULL) ? -1: 1; |
| 1041 } else if (!g_ascii_strcasecmp(name1, "none")) { |
978 } else if (!g_ascii_strcasecmp(name1, "none")) { |
| 1047 } else if (!g_ascii_strcasecmp(name2, "none")) { |
984 } else if (!g_ascii_strcasecmp(name2, "none")) { |
| 1048 /* Sort name2 first */ |
985 /* Sort name2 first */ |
| 1049 ret = 1; |
986 ret = 1; |
| 1050 } else { |
987 } else { |
| 1051 /* Neither string is "none", default to normal sort */ |
988 /* Neither string is "none", default to normal sort */ |
| 1052 ret = purple_utf8_strcasecmp(name1,name2); |
989 ret = purple_utf8_strcasecmp(name1, name2); |
| 1053 } |
990 } |
| 1054 |
991 |
| 1055 g_free(name1); |
992 g_free(name1); |
| 1056 g_free(name2); |
993 g_free(name2); |
| 1057 |
994 |
| 1058 return ret; |
995 return ret; |
| 1059 } |
|
| 1060 |
|
| 1061 static void |
|
| 1062 request_theme_file_name_cb(gpointer data, char *theme_file_name) |
|
| 1063 { |
|
| 1064 struct theme_info *info = g_new0(struct theme_info, 1); |
|
| 1065 info->type = g_strdup("smiley"); |
|
| 1066 |
|
| 1067 theme_install_theme(theme_file_name, info); |
|
| 1068 } |
|
| 1069 |
|
| 1070 static void |
|
| 1071 add_theme_button_clicked_cb(GtkWidget *widget, gpointer user_data) |
|
| 1072 { |
|
| 1073 purple_request_file(NULL, _("Install Theme"), NULL, FALSE, (GCallback)request_theme_file_name_cb, NULL, NULL, NULL, NULL, NULL); |
|
| 1074 } |
|
| 1075 |
|
| 1076 static void |
|
| 1077 remove_theme_button_clicked_cb(GtkWidget *button, GtkTreeView *tv) |
|
| 1078 { |
|
| 1079 char *theme_name = NULL, *theme_file = NULL; |
|
| 1080 GtkTreeModel *tm; |
|
| 1081 GtkTreeIter itr; |
|
| 1082 GtkTreeRowReference *trr = NULL; |
|
| 1083 |
|
| 1084 if ((tm = gtk_tree_view_get_model(tv)) == NULL) |
|
| 1085 return; |
|
| 1086 if (!gtk_tree_selection_get_selected(smiley_theme_sel, NULL, &itr)) |
|
| 1087 return; |
|
| 1088 gtk_tree_model_get(tm, &itr, 2, &theme_file, 3, &theme_name, -1); |
|
| 1089 |
|
| 1090 if (theme_file && theme_name && strcmp(theme_name, "none")) |
|
| 1091 pidgin_themes_remove_smiley_theme(theme_file); |
|
| 1092 |
|
| 1093 if ((trr = theme_refresh_theme_list()) != NULL) { |
|
| 1094 GtkTreePath *tp = gtk_tree_row_reference_get_path(trr); |
|
| 1095 |
|
| 1096 if (tp) { |
|
| 1097 gtk_tree_selection_select_path(smiley_theme_sel, tp); |
|
| 1098 gtk_tree_path_free(tp); |
|
| 1099 } |
|
| 1100 gtk_tree_row_reference_free(trr); |
|
| 1101 } |
|
| 1102 |
|
| 1103 g_free(theme_file); |
|
| 1104 g_free(theme_name); |
|
| 1105 } |
996 } |
| 1106 |
997 |
| 1107 /* sets the current buddy list theme */ |
998 /* sets the current buddy list theme */ |
| 1108 static void |
999 static void |
| 1109 prefs_set_blist_theme_cb(GtkComboBox *combo_box, gpointer user_data) |
1000 prefs_set_blist_theme_cb(GtkComboBox *combo_box, gpointer user_data) |
| 1148 } |
1039 } |
| 1149 |
1040 |
| 1150 static GtkWidget * |
1041 static GtkWidget * |
| 1151 theme_page(void) |
1042 theme_page(void) |
| 1152 { |
1043 { |
| 1153 GtkWidget *add_button, *remove_button; |
|
| 1154 GtkWidget *hbox_buttons; |
|
| 1155 GtkWidget *alignment; |
|
| 1156 GtkWidget *ret; |
1044 GtkWidget *ret; |
| 1157 GtkWidget *sw; |
|
| 1158 GtkWidget *view; |
|
| 1159 GtkCellRenderer *rend; |
|
| 1160 GtkTreeViewColumn *col; |
|
| 1161 GtkTreeSelection *sel; |
|
| 1162 GtkTreeRowReference *rowref; |
|
| 1163 GtkWidget *label; |
1045 GtkWidget *label; |
| 1164 GtkTargetEntry te[3] = { |
|
| 1165 {"text/plain", 0, 0}, |
|
| 1166 {"text/uri-list", 0, 1}, |
|
| 1167 {"STRING", 0, 2} |
|
| 1168 }; |
|
| 1169 GtkWidget *themesel_hbox; |
1046 GtkWidget *themesel_hbox; |
| 1170 GtkSizeGroup *label_sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
1047 GtkSizeGroup *label_sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
| 1171 GtkSizeGroup *combo_sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
1048 GtkSizeGroup *combo_sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
| 1172 |
1049 |
| 1173 ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); |
1050 ret = gtk_vbox_new(FALSE, PIDGIN_HIG_CAT_SPACE); |
| 1174 gtk_container_set_border_width (GTK_CONTAINER (ret), PIDGIN_HIG_BORDER); |
1051 gtk_container_set_border_width (GTK_CONTAINER (ret), PIDGIN_HIG_BORDER); |
| |
1052 |
| |
1053 /* Instructions */ |
| |
1054 label = gtk_label_new(_("Select a theme that you would like to use from " |
| |
1055 "the lists below. New themes can be installed by " |
| |
1056 "dragging and dropping them onto the theme list.")); |
| |
1057 |
| |
1058 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
| |
1059 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
| |
1060 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); |
| |
1061 |
| |
1062 gtk_box_pack_start(GTK_BOX(ret), label, FALSE, FALSE, 0); |
| |
1063 gtk_widget_show(label); |
| 1175 |
1064 |
| 1176 /* Buddy List Themes */ |
1065 /* Buddy List Themes */ |
| 1177 themesel_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
1066 themesel_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
| 1178 |
1067 |
| 1179 label = gtk_label_new(_("Buddy List Theme:")); |
1068 label = gtk_label_new(_("Buddy List Theme:")); |
| 1223 gtk_box_pack_start(GTK_BOX(themesel_hbox), prefs_sound_themes_combo_box, FALSE, FALSE, 0); |
1112 gtk_box_pack_start(GTK_BOX(themesel_hbox), prefs_sound_themes_combo_box, FALSE, FALSE, 0); |
| 1224 |
1113 |
| 1225 gtk_box_pack_start(GTK_BOX(ret), themesel_hbox, FALSE, FALSE, 0); |
1114 gtk_box_pack_start(GTK_BOX(ret), themesel_hbox, FALSE, FALSE, 0); |
| 1226 |
1115 |
| 1227 /* Smiley Themes */ |
1116 /* Smiley Themes */ |
| 1228 label = gtk_label_new(_("Select a smiley theme that you would like to use " |
1117 themesel_hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
| 1229 "from the list below. New themes can be installed " |
1118 |
| 1230 "by dragging and dropping them onto the theme list.")); |
1119 label = gtk_label_new(_("Smiley Theme:")); |
| 1231 |
1120 gtk_size_group_add_widget(label_sg, label); |
| 1232 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
1121 gtk_box_pack_start(GTK_BOX(themesel_hbox), label, FALSE, FALSE, 0); |
| 1233 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
1122 |
| 1234 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); |
1123 prefs_smiley_themes_combo_box = prefs_build_theme_combo_box(prefs_smiley_themes, |
| 1235 |
1124 purple_prefs_get_string(PIDGIN_PREFS_ROOT "/smileys/theme"), |
| 1236 gtk_box_pack_start(GTK_BOX(ret), label, FALSE, FALSE, 0); |
1125 "smiley"); |
| 1237 gtk_widget_show(label); |
1126 g_signal_connect(G_OBJECT(prefs_smiley_themes_combo_box), "changed", |
| 1238 |
1127 (GCallback)prefs_set_smiley_theme_cb, NULL); |
| 1239 sw = gtk_scrolled_window_new(NULL,NULL); |
1128 gtk_size_group_add_widget(combo_sg, prefs_smiley_themes_combo_box); |
| 1240 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
1129 gtk_box_pack_start(GTK_BOX(themesel_hbox), prefs_smiley_themes_combo_box, FALSE, FALSE, 0); |
| 1241 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
1130 |
| 1242 |
1131 gtk_box_pack_start(GTK_BOX(ret), themesel_hbox, FALSE, FALSE, 0); |
| 1243 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); |
|
| 1244 smiley_theme_store = gtk_list_store_new (4, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); |
|
| 1245 |
|
| 1246 rowref = theme_refresh_theme_list(); |
|
| 1247 |
|
| 1248 view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(smiley_theme_store)); |
|
| 1249 |
|
| 1250 gtk_drag_dest_set(view, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP, te, |
|
| 1251 sizeof(te) / sizeof(GtkTargetEntry) , GDK_ACTION_COPY | GDK_ACTION_MOVE); |
|
| 1252 |
|
| 1253 g_signal_connect(G_OBJECT(view), "drag_data_received", G_CALLBACK(theme_dnd_recv), "smiley"); |
|
| 1254 |
|
| 1255 rend = gtk_cell_renderer_pixbuf_new(); |
|
| 1256 smiley_theme_sel = sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (view)); |
|
| 1257 |
1132 |
| 1258 /* Custom sort so "none" theme is at top of list */ |
1133 /* Custom sort so "none" theme is at top of list */ |
| 1259 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(smiley_theme_store), |
1134 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(prefs_smiley_themes), |
| 1260 3, pidgin_sort_smileys, NULL, NULL); |
1135 2, pidgin_sort_smileys, NULL, NULL); |
| 1261 |
1136 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(prefs_smiley_themes), |
| 1262 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(smiley_theme_store), |
1137 2, GTK_SORT_ASCENDING); |
| 1263 3, GTK_SORT_ASCENDING); |
|
| 1264 |
|
| 1265 col = gtk_tree_view_column_new_with_attributes (_("Icon"), |
|
| 1266 rend, |
|
| 1267 "pixbuf", 0, |
|
| 1268 NULL); |
|
| 1269 gtk_tree_view_append_column (GTK_TREE_VIEW(view), col); |
|
| 1270 |
|
| 1271 rend = gtk_cell_renderer_text_new(); |
|
| 1272 col = gtk_tree_view_column_new_with_attributes (_("Description"), |
|
| 1273 rend, |
|
| 1274 "markup", 1, |
|
| 1275 NULL); |
|
| 1276 gtk_tree_view_append_column (GTK_TREE_VIEW(view), col); |
|
| 1277 g_object_unref(G_OBJECT(smiley_theme_store)); |
|
| 1278 gtk_container_add(GTK_CONTAINER(sw), view); |
|
| 1279 |
|
| 1280 g_signal_connect(G_OBJECT(sel), "changed", G_CALLBACK(smiley_sel), NULL); |
|
| 1281 |
|
| 1282 alignment = gtk_alignment_new(1.0, 0.5, 0.0, 1.0); |
|
| 1283 gtk_widget_show(alignment); |
|
| 1284 gtk_box_pack_start(GTK_BOX(ret), alignment, FALSE, TRUE, 0); |
|
| 1285 |
|
| 1286 hbox_buttons = gtk_hbox_new(TRUE, PIDGIN_HIG_CAT_SPACE); |
|
| 1287 gtk_widget_show(hbox_buttons); |
|
| 1288 gtk_container_add(GTK_CONTAINER(alignment), hbox_buttons); |
|
| 1289 |
|
| 1290 add_button = gtk_button_new_from_stock(GTK_STOCK_ADD); |
|
| 1291 gtk_widget_show(add_button); |
|
| 1292 gtk_box_pack_start(GTK_BOX(hbox_buttons), add_button, FALSE, TRUE, 0); |
|
| 1293 g_signal_connect(G_OBJECT(add_button), "clicked", (GCallback)add_theme_button_clicked_cb, view); |
|
| 1294 |
|
| 1295 remove_button = gtk_button_new_from_stock(GTK_STOCK_REMOVE); |
|
| 1296 gtk_widget_show(remove_button); |
|
| 1297 gtk_box_pack_start(GTK_BOX(hbox_buttons), remove_button, FALSE, TRUE, 0); |
|
| 1298 g_signal_connect(G_OBJECT(remove_button), "clicked", (GCallback)remove_theme_button_clicked_cb, view); |
|
| 1299 g_object_set_data(G_OBJECT(sel), "remove_button", remove_button); |
|
| 1300 |
|
| 1301 if (rowref) { |
|
| 1302 GtkTreePath *path = gtk_tree_row_reference_get_path(rowref); |
|
| 1303 gtk_tree_row_reference_free(rowref); |
|
| 1304 gtk_tree_selection_select_path(sel, path); |
|
| 1305 gtk_tree_path_free(path); |
|
| 1306 } |
|
| 1307 |
1138 |
| 1308 gtk_widget_show_all(ret); |
1139 gtk_widget_show_all(ret); |
| 1309 |
|
| 1310 pidgin_set_accessible_label (view, label); |
|
| 1311 |
1140 |
| 1312 return ret; |
1141 return ret; |
| 1313 } |
1142 } |
| 1314 |
1143 |
| 1315 static void |
1144 static void |