Mercurial > pidgin
diff src/gtknotify.c @ 12624:851b0bd7eb52
[gaim-migrate @ 14960]
busy busy busy...
* fixed some unused variable warnings in a few places
* fixed memleak in the searchresults notify
* added more button types to the searchresults notify (IM, Info, Invite,
Join, and arbitrary labels)
* added a conversation ui op to present a conversation, since there
appears to be no way to actually initiate an IM without breaking the
core/ui split. gaim_conversation_present now ends up calling
gaim_gtkconv_present_conversation
* changed sametime prpl to use the searchresults notify instead of the
requests API for its "ambiguous user" dialog
* it should be possible to use the searchresults notify for room listing,
if anyone is thusly interested
committer: Tailor Script <tailor@pidgin.im>
author | Christopher O'Brien <siege@pidgin.im> |
---|---|
date | Thu, 22 Dec 2005 17:16:57 +0000 |
parents | e856f985a0b9 |
children | 852df2d9d4f8 |
line wrap: on
line diff
--- a/src/gtknotify.c Thu Dec 22 16:06:41 2005 +0000 +++ b/src/gtknotify.c Thu Dec 22 17:16:57 2005 +0000 @@ -475,13 +475,12 @@ { GtkWidget *window; GtkWidget *treeview; - GtkWidget *button, *close_button; + GtkWidget *close_button; GType *col_types; GtkListStore *model; GtkCellRenderer *renderer; guint col_num; guint i; - GList *buttons = NULL; GtkWidget *vbox; GtkWidget *button_area; @@ -581,21 +580,48 @@ for (i = 0; i < g_list_length(results->buttons); i++) { GaimNotifySearchButton *b = g_list_nth_data(results->buttons, i); - button = NULL; + GtkWidget *button = NULL; switch (b->type) { + case GAIM_NOTIFY_BUTTON_LABELED: + if(b->label) { + button = gtk_button_new_with_label(b->label); + } else { + gaim_debug_warning("gtknotify", "Missing button label"); + } + break; case GAIM_NOTIFY_BUTTON_CONTINUE: button = gtk_button_new_from_stock(GTK_STOCK_GO_FORWARD); break; - case GAIM_NOTIFY_BUTTON_ADD_BUDDY: + case GAIM_NOTIFY_BUTTON_ADD: button = gtk_button_new_from_stock(GTK_STOCK_ADD); break; + case GAIM_NOTIFY_BUTTON_INFO: + button = gtk_button_new_from_stock(GAIM_STOCK_INFO); + break; + case GAIM_NOTIFY_BUTTON_IM: + button = gtk_button_new_from_stock(GAIM_STOCK_IM); + break; + case GAIM_NOTIFY_BUTTON_JOIN: + button = gtk_button_new_from_stock(GAIM_STOCK_CHAT); + break; + case GAIM_NOTIFY_BUTTON_INVITE: + button = gtk_button_new_from_stock(GAIM_STOCK_INVITE); + break; default: gaim_debug_warning("gtknotify", "Incorrect button type: %d\n", b->type); } if (button != NULL) { + GaimNotifySearchResultsButtonData *bd; + gtk_box_pack_start(GTK_BOX(button_area), button, FALSE, FALSE, 0); gtk_widget_show(button); - buttons = g_list_append(buttons, button); + + bd = g_new0(GaimNotifySearchResultsButtonData, 1); + bd->button = b; + bd->data = data; + + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(searchresults_callback_wrapper_cb), bd); } } @@ -604,6 +630,9 @@ gtk_box_pack_start(GTK_BOX(button_area), close_button, FALSE, FALSE, 0); gtk_widget_show(close_button); + g_signal_connect_swapped(G_OBJECT(close_button), "clicked", + G_CALLBACK(searchresults_close_cb), data); + data->account = gc->account; data->model = model; data->treeview = treeview; @@ -612,18 +641,6 @@ /* Insert rows. */ gaim_gtk_notify_searchresults_new_rows(gc, results, data, NULL); - /* Connect Signals */ - for (i = 0; i < g_list_length(results->buttons); i++) { - GaimNotifySearchResultsButtonData *bd = g_new0(GaimNotifySearchResultsButtonData, 1); - bd->button = g_list_nth_data(results->buttons, i); - bd->data = data; - g_signal_connect(G_OBJECT(g_list_nth_data(buttons, i)), "clicked", - G_CALLBACK(searchresults_callback_wrapper_cb), bd); - } - - g_signal_connect_swapped(G_OBJECT(close_button), "clicked", - G_CALLBACK(searchresults_close_cb), data); - /* Show the window */ gtk_widget_show(window); return data;