pidgin/gtkstatusbox.c

branch
release-2.2.2
changeset 20214
6b993c1f4c6a
parent 20147
66f05a854eee
child 20289
5c844288fbec
child 21162
8359073125ba
equal deleted inserted replaced
20213:3edb61aa5767 20214:6b993c1f4c6a
1393 GDK_CURRENT_TIME, TRUE)) { 1393 GDK_CURRENT_TIME, TRUE)) {
1394 gtk_widget_hide (box->popup_window); 1394 gtk_widget_hide (box->popup_window);
1395 return; 1395 return;
1396 } 1396 }
1397 gtk_grab_add (box->popup_window); 1397 gtk_grab_add (box->popup_window);
1398 // box->popup_in_progress = TRUE; 1398 /*box->popup_in_progress = TRUE;*/
1399 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (box->toggle_button), 1399 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (box->toggle_button),
1400 TRUE); 1400 TRUE);
1401 1401
1402 if (box->active_row) { 1402 if (box->active_row) {
1403 GtkTreePath *path = gtk_tree_row_reference_get_path(box->active_row); 1403 GtkTreePath *path = gtk_tree_row_reference_get_path(box->active_row);
1405 gtk_tree_path_free(path); 1405 gtk_tree_path_free(path);
1406 } 1406 }
1407 } 1407 }
1408 1408
1409 static void 1409 static void
1410 pidgin_status_box_popdown(PidginStatusBox *box) { 1410 pidgin_status_box_popdown(PidginStatusBox *box)
1411 {
1411 gtk_widget_hide(box->popup_window); 1412 gtk_widget_hide(box->popup_window);
1412 box->popup_in_progress = FALSE; 1413 box->popup_in_progress = FALSE;
1413 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (box->toggle_button), 1414 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (box->toggle_button),
1414 FALSE); 1415 FALSE);
1415 gtk_grab_remove (box->popup_window); 1416 gtk_grab_remove (box->popup_window);
1416 } 1417 }
1417 1418
1418 1419 static gboolean
1419 static 1420 toggle_key_press_cb(GtkWidget *widget, GdkEventKey *event, PidginStatusBox *box)
1420 gboolean 1421 {
1422 switch (event->keyval) {
1423 case GDK_Return:
1424 case GDK_KP_Enter:
1425 case GDK_KP_Space:
1426 case GDK_space:
1427 if (!box->popup_in_progress) {
1428 pidgin_status_box_popup (box);
1429 box->popup_in_progress = TRUE;
1430 } else {
1431 pidgin_status_box_popdown(box);
1432 }
1433 return TRUE;
1434 default:
1435 return TRUE;
1436 }
1437 }
1438
1439 static gboolean
1421 toggled_cb(GtkWidget *widget, GdkEventButton *event, PidginStatusBox *box) 1440 toggled_cb(GtkWidget *widget, GdkEventButton *event, PidginStatusBox *box)
1422 { 1441 {
1423 if (!box->popup_in_progress) 1442 if (!box->popup_in_progress)
1424 pidgin_status_box_popup (box); 1443 pidgin_status_box_popup (box);
1425 else 1444 else
1426 pidgin_status_box_popdown(box); 1445 pidgin_status_box_popdown(box);
1427 return TRUE; 1446 return TRUE;
1428 } 1447 }
1429 1448
1430 static void 1449 static void
1431 buddy_icon_set_cb(const char *filename, PidginStatusBox *box) 1450 buddy_icon_set_cb(const char *filename, PidginStatusBox *box)
1432 { 1451 {
1773 g_signal_connect(G_OBJECT(status_box->toggle_button), "button-press-event", 1792 g_signal_connect(G_OBJECT(status_box->toggle_button), "button-press-event",
1774 G_CALLBACK(button_pressed_cb), status_box); 1793 G_CALLBACK(button_pressed_cb), status_box);
1775 g_signal_connect(G_OBJECT(status_box->toggle_button), "button-release-event", 1794 g_signal_connect(G_OBJECT(status_box->toggle_button), "button-release-event",
1776 G_CALLBACK(button_released_cb), status_box); 1795 G_CALLBACK(button_released_cb), status_box);
1777 #endif 1796 #endif
1797 g_signal_connect(G_OBJECT(status_box->toggle_button), "key-press-event",
1798 G_CALLBACK(toggle_key_press_cb), status_box);
1778 g_signal_connect(G_OBJECT(status_box->toggle_button), "button-press-event", 1799 g_signal_connect(G_OBJECT(status_box->toggle_button), "button-press-event",
1779 G_CALLBACK(toggled_cb), status_box); 1800 G_CALLBACK(toggled_cb), status_box);
1780 g_signal_connect(G_OBJECT(buffer), "changed", G_CALLBACK(imhtml_changed_cb), status_box); 1801 g_signal_connect(G_OBJECT(buffer), "changed", G_CALLBACK(imhtml_changed_cb), status_box);
1781 g_signal_connect(G_OBJECT(status_box->imhtml), "format_function_toggle", 1802 g_signal_connect(G_OBJECT(status_box->imhtml), "format_function_toggle",
1782 G_CALLBACK(imhtml_format_changed_cb), status_box); 1803 G_CALLBACK(imhtml_format_changed_cb), status_box);

mercurial