| 81 SMILEY_LIST_MODEL_SHORTCUT, |
79 SMILEY_LIST_MODEL_SHORTCUT, |
| 82 SMILEY_LIST_MODEL_PURPLESMILEY, |
80 SMILEY_LIST_MODEL_PURPLESMILEY, |
| 83 SMILEY_LIST_MODEL_N_COL |
81 SMILEY_LIST_MODEL_N_COL |
| 84 }; |
82 }; |
| 85 |
83 |
| |
84 enum |
| |
85 { |
| |
86 PIDGIN_RESPONSE_MODIFY |
| |
87 }; |
| |
88 |
| 86 static SmileyManager *smiley_manager = NULL; |
89 static SmileyManager *smiley_manager = NULL; |
| 87 |
90 |
| 88 /****************************************************************************** |
|
| 89 * New routines (TODO) |
|
| 90 *****************************************************************************/ |
|
| 91 |
|
| 92 static void |
91 static void |
| 93 edit_dialog_destroy(GtkWidget *window, gpointer _edit_dialog) |
92 edit_dialog_destroy(GtkWidget *window, gpointer _edit_dialog) |
| 94 { |
93 { |
| 95 SmileyEditDialog *edit_dialog = _edit_dialog; |
94 SmileyEditDialog *edit_dialog = _edit_dialog; |
| 96 |
95 |
| 97 g_object_set_data(G_OBJECT(edit_dialog->smiley), |
96 if (edit_dialog->smiley) { |
| 98 "pidgin-smiley-manager-edit-dialog", NULL); |
97 g_object_set_data(G_OBJECT(edit_dialog->smiley), |
| 99 g_object_unref(edit_dialog->smiley); |
98 "pidgin-smiley-manager-edit-dialog", NULL); |
| |
99 g_object_unref(edit_dialog->smiley); |
| |
100 } |
| 100 |
101 |
| 101 g_free(edit_dialog->filename); |
102 g_free(edit_dialog->filename); |
| 102 g_free(edit_dialog); |
103 g_free(edit_dialog); |
| 103 } |
104 } |
| 104 |
105 |
| 118 if (!pixbuf) { |
119 if (!pixbuf) { |
| 119 GtkIconSize icon_size = |
120 GtkIconSize icon_size = |
| 120 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL); |
121 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_SMALL); |
| 121 pixbuf = gtk_widget_render_icon(GTK_WIDGET(edit_dialog->window), |
122 pixbuf = gtk_widget_render_icon(GTK_WIDGET(edit_dialog->window), |
| 122 PIDGIN_STOCK_TOOLBAR_SELECT_AVATAR, icon_size, |
123 PIDGIN_STOCK_TOOLBAR_SELECT_AVATAR, icon_size, |
| 123 "PidginSmiley"); |
124 "PidginSmileyManager"); |
| 124 } |
125 } |
| 125 g_return_if_fail(pixbuf != NULL); |
126 g_return_if_fail(pixbuf != NULL); |
| 126 |
127 |
| 127 gtk_image_set_from_pixbuf(GTK_IMAGE(edit_dialog->thumbnail), pixbuf); |
128 gtk_image_set_from_pixbuf(GTK_IMAGE(edit_dialog->thumbnail), pixbuf); |
| 128 |
129 |
| 138 image_ok = (edit_dialog->filename != NULL); |
139 image_ok = (edit_dialog->filename != NULL); |
| 139 |
140 |
| 140 gtk_dialog_set_response_sensitive(edit_dialog->window, |
141 gtk_dialog_set_response_sensitive(edit_dialog->window, |
| 141 GTK_RESPONSE_ACCEPT, shortcut_ok && image_ok); |
142 GTK_RESPONSE_ACCEPT, shortcut_ok && image_ok); |
| 142 } |
143 } |
| 143 |
|
| 144 |
|
| 145 /****************************************************************************** |
|
| 146 * Manager stuff |
|
| 147 *****************************************************************************/ |
|
| 148 |
|
| 149 #if 0 |
|
| 150 static void refresh_list(void); |
|
| 151 #endif |
|
| 152 |
|
| 153 /****************************************************************************** |
|
| 154 * The Add dialog |
|
| 155 ******************************************************************************/ |
|
| 156 |
144 |
| 157 #if 0 |
145 #if 0 |
| 158 static void do_add(GtkWidget *widget, PidginSmiley *s) |
146 static void do_add(GtkWidget *widget, PidginSmiley *s) |
| 159 { |
147 { |
| 160 const gchar *entry; |
148 const gchar *entry; |
| 304 SmileyEditDialog *edit_dialog; |
292 SmileyEditDialog *edit_dialog; |
| 305 GtkWidget *vbox, *hbox; |
293 GtkWidget *vbox, *hbox; |
| 306 GtkLabel *label; |
294 GtkLabel *label; |
| 307 GtkButton *filech; |
295 GtkButton *filech; |
| 308 |
296 |
| 309 edit_dialog = g_object_get_data(G_OBJECT(smiley), |
297 if (smiley) { |
| 310 "pidgin-smiley-manager-edit-dialog"); |
298 edit_dialog = g_object_get_data(G_OBJECT(smiley), |
| 311 if (edit_dialog) { |
299 "pidgin-smiley-manager-edit-dialog"); |
| 312 gtk_window_present(GTK_WINDOW(edit_dialog->window)); |
300 if (edit_dialog) { |
| 313 return; |
301 gtk_window_present(GTK_WINDOW(edit_dialog->window)); |
| |
302 return; |
| |
303 } |
| 314 } |
304 } |
| 315 |
305 |
| 316 edit_dialog = g_new0(SmileyEditDialog, 1); |
306 edit_dialog = g_new0(SmileyEditDialog, 1); |
| 317 |
307 |
| 318 edit_dialog->window = GTK_DIALOG(gtk_dialog_new_with_buttons( |
308 edit_dialog->window = GTK_DIALOG(gtk_dialog_new_with_buttons( |
| 322 smiley ? GTK_STOCK_SAVE : GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT, |
312 smiley ? GTK_STOCK_SAVE : GTK_STOCK_ADD, GTK_RESPONSE_ACCEPT, |
| 323 NULL)); |
313 NULL)); |
| 324 gtk_dialog_set_default_response( |
314 gtk_dialog_set_default_response( |
| 325 edit_dialog->window, GTK_RESPONSE_ACCEPT); |
315 edit_dialog->window, GTK_RESPONSE_ACCEPT); |
| 326 |
316 |
| 327 edit_dialog->smiley = smiley; |
317 if (smiley) { |
| 328 g_object_set_data(G_OBJECT(smiley), |
318 edit_dialog->smiley = smiley; |
| 329 "pidgin-smiley-manager-edit-dialog", edit_dialog); |
319 g_object_set_data(G_OBJECT(smiley), |
| 330 g_object_ref(smiley); |
320 "pidgin-smiley-manager-edit-dialog", edit_dialog); |
| |
321 g_object_ref(smiley); |
| |
322 } |
| 331 |
323 |
| 332 #if !GTK_CHECK_VERSION(3,0,0) |
324 #if !GTK_CHECK_VERSION(3,0,0) |
| 333 gtk_container_set_border_width( |
325 gtk_container_set_border_width( |
| 334 GTK_CONTAINER(edit_dialog->window), PIDGIN_HIG_BORDER); |
326 GTK_CONTAINER(edit_dialog->window), PIDGIN_HIG_BORDER); |
| 335 #endif |
327 #endif |
| 500 GtkTreeIter *iter, gpointer data) |
492 GtkTreeIter *iter, gpointer data) |
| 501 { |
493 { |
| 502 GList **list = data; |
494 GList **list = data; |
| 503 *list = g_list_prepend(*list, gtk_tree_path_copy(path)); |
495 *list = g_list_prepend(*list, gtk_tree_path_copy(path)); |
| 504 } |
496 } |
| 505 #endif |
497 |
| 506 |
|
| 507 #if 0 |
|
| 508 static void smiley_delete(SmileyManager *dialog) |
498 static void smiley_delete(SmileyManager *dialog) |
| 509 { |
499 { |
| 510 GtkTreeSelection *selection; |
500 GtkTreeSelection *selection; |
| 511 GList *list = NULL; |
501 GList *list = NULL; |
| 512 |
502 |
| 521 gtk_tree_path_free(list->data); |
511 gtk_tree_path_free(list->data); |
| 522 list = g_list_delete_link(list, list); |
512 list = g_list_delete_link(list, list); |
| 523 } |
513 } |
| 524 } |
514 } |
| 525 #endif |
515 #endif |
| 526 |
|
| 527 |
|
| 528 /****************************************************************************** |
|
| 529 * The Smiley Manager |
|
| 530 *****************************************************************************/ |
|
| 531 |
516 |
| 532 #if 0 |
517 #if 0 |
| 533 static void |
518 static void |
| 534 smiley_got_url(PurpleHttpConnection *http_conn, PurpleHttpResponse *response, |
519 smiley_got_url(PurpleHttpConnection *http_conn, PurpleHttpResponse *response, |
| 535 gpointer _dialog) |
520 gpointer _dialog) |
| 751 |
736 |
| 752 return pidgin_make_scrollable(GTK_WIDGET(tree), GTK_POLICY_AUTOMATIC, |
737 return pidgin_make_scrollable(GTK_WIDGET(tree), GTK_POLICY_AUTOMATIC, |
| 753 GTK_POLICY_AUTOMATIC, GTK_SHADOW_IN, -1, -1); |
738 GTK_POLICY_AUTOMATIC, GTK_SHADOW_IN, -1, -1); |
| 754 } |
739 } |
| 755 |
740 |
| 756 #if 0 |
|
| 757 static void refresh_list() |
|
| 758 { |
|
| 759 populate_smiley_list(smiley_manager); |
|
| 760 } |
|
| 761 #endif |
|
| 762 |
|
| 763 static void |
741 static void |
| 764 smiley_manager_select_cb(GtkWidget *widget, gint resp, SmileyManager *manager) |
742 smiley_manager_select_cb(GtkWidget *widget, gint resp, SmileyManager *manager) |
| 765 { |
743 { |
| 766 GtkTreeSelection *selection = NULL; |
744 GtkTreeSelection *selection = NULL; |
| 767 GList *selected_rows, *selected_smileys = NULL, *it; |
745 GList *selected_rows, *selected_smileys = NULL, *it; |