Mercurial > pidgin.yaz
diff pidgin/gtkstatusbox.c @ 21563:1b174854bb80
merge of '30fcf2f336afb635b62a5c3ed3adb3e1fa1dd2d1'
and 'bb60447c0a8c79afca320f4dc689096f4788e7fa'
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sat, 17 Nov 2007 01:55:21 +0000 |
parents | 665e04562de0 |
children | 2a591a5b3322 |
line wrap: on
line diff
--- a/pidgin/gtkstatusbox.c Wed Nov 14 03:15:32 2007 +0000 +++ b/pidgin/gtkstatusbox.c Sat Nov 17 01:55:21 2007 +0000 @@ -276,7 +276,7 @@ return FALSE; } - box->buddy_icon_sel = pidgin_buddy_icon_chooser_new(NULL, icon_choose_cb, box); + box->buddy_icon_sel = pidgin_buddy_icon_chooser_new(GTK_WINDOW(gtk_widget_get_toplevel(widget)), icon_choose_cb, box); gtk_widget_show_all(box->buddy_icon_sel); } return FALSE; @@ -1069,8 +1069,8 @@ add_popular_statuses(status_box); pidgin_status_box_add_separator(PIDGIN_STATUS_BOX(status_box)); - pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_CUSTOM, NULL, _("New..."), NULL, NULL); - pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_SAVED, NULL, _("Saved..."), NULL, NULL); + pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_CUSTOM, NULL, _("New status..."), NULL, NULL); + pidgin_status_box_add(PIDGIN_STATUS_BOX(status_box), PIDGIN_STATUS_BOX_TYPE_SAVED, NULL, _("Saved statuses..."), NULL, NULL); if (pixbuf) g_object_unref(G_OBJECT(pixbuf)); status_menu_refresh_iter(status_box); @@ -1395,7 +1395,7 @@ return; } gtk_grab_add (box->popup_window); -// box->popup_in_progress = TRUE; + /*box->popup_in_progress = TRUE;*/ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (box->toggle_button), TRUE); @@ -1407,7 +1407,8 @@ } static void -pidgin_status_box_popdown(PidginStatusBox *box) { +pidgin_status_box_popdown(PidginStatusBox *box) +{ gtk_widget_hide(box->popup_window); box->popup_in_progress = FALSE; gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (box->toggle_button), @@ -1415,16 +1416,34 @@ gtk_grab_remove (box->popup_window); } +static gboolean +toggle_key_press_cb(GtkWidget *widget, GdkEventKey *event, PidginStatusBox *box) +{ + switch (event->keyval) { + case GDK_Return: + case GDK_KP_Enter: + case GDK_KP_Space: + case GDK_space: + if (!box->popup_in_progress) { + pidgin_status_box_popup (box); + box->popup_in_progress = TRUE; + } else { + pidgin_status_box_popdown(box); + } + return TRUE; + default: + return TRUE; + } +} -static -gboolean +static gboolean toggled_cb(GtkWidget *widget, GdkEventButton *event, PidginStatusBox *box) { - if (!box->popup_in_progress) - pidgin_status_box_popup (box); - else - pidgin_status_box_popdown(box); -return TRUE; + if (!box->popup_in_progress) + pidgin_status_box_popup (box); + else + pidgin_status_box_popdown(box); + return TRUE; } static void @@ -1775,6 +1794,8 @@ g_signal_connect(G_OBJECT(status_box->toggle_button), "button-release-event", G_CALLBACK(button_released_cb), status_box); #endif + g_signal_connect(G_OBJECT(status_box->toggle_button), "key-press-event", + G_CALLBACK(toggle_key_press_cb), status_box); g_signal_connect(G_OBJECT(status_box->toggle_button), "button-press-event", G_CALLBACK(toggled_cb), status_box); g_signal_connect(G_OBJECT(buffer), "changed", G_CALLBACK(imhtml_changed_cb), status_box); @@ -2141,6 +2162,9 @@ purple_imgstore_get_size(status_box->buddy_icon_img), NULL); gdk_pixbuf_loader_close(loader, NULL); status_box->buddy_icon = gdk_pixbuf_loader_get_pixbuf(loader); + if (status_box->buddy_icon) + g_object_ref(status_box->buddy_icon); + g_object_unref(loader); } if (status_box->buddy_icon == NULL)