| 80 static void pidgin_status_box_pulse_typing(PidginStatusBox *status_box); |
80 static void pidgin_status_box_pulse_typing(PidginStatusBox *status_box); |
| 81 static void pidgin_status_box_refresh(PidginStatusBox *status_box); |
81 static void pidgin_status_box_refresh(PidginStatusBox *status_box); |
| 82 static void status_menu_refresh_iter(PidginStatusBox *status_box, gboolean status_changed); |
82 static void status_menu_refresh_iter(PidginStatusBox *status_box, gboolean status_changed); |
| 83 static void pidgin_status_box_regenerate(PidginStatusBox *status_box, gboolean status_changed); |
83 static void pidgin_status_box_regenerate(PidginStatusBox *status_box, gboolean status_changed); |
| 84 static void pidgin_status_box_changed(PidginStatusBox *box); |
84 static void pidgin_status_box_changed(PidginStatusBox *box); |
| 85 static void pidgin_status_box_size_request (GtkWidget *widget, GtkRequisition *requisition); |
85 /*static void pidgin_status_box_size_request (GtkWidget *widget, GtkRequisition *requisition);*/ |
| 86 static void pidgin_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); |
86 static void pidgin_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); |
| 87 static gboolean pidgin_status_box_expose_event (GtkWidget *widget, GdkEventExpose *event); |
87 /*static gboolean pidgin_status_box_expose_event (GtkWidget *widget, GdkEventExpose *event);*/ |
| 88 static void pidgin_status_box_redisplay_buddy_icon(PidginStatusBox *status_box); |
88 static void pidgin_status_box_redisplay_buddy_icon(PidginStatusBox *status_box); |
| 89 static void pidgin_status_box_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); |
89 static void pidgin_status_box_forall (GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data); |
| 90 static void pidgin_status_box_popup(PidginStatusBox *box); |
90 static void pidgin_status_box_popup(PidginStatusBox *box); |
| 91 static void pidgin_status_box_popdown(PidginStatusBox *box); |
91 static void pidgin_status_box_popdown(PidginStatusBox *box); |
| 92 |
92 |
| 280 |
280 |
| 281 message = purple_status_get_attr_string(newstatus, "message"); |
281 message = purple_status_get_attr_string(newstatus, "message"); |
| 282 |
282 |
| 283 if (!message || !*message) |
283 if (!message || !*message) |
| 284 { |
284 { |
| 285 gtk_widget_hide_all(status_box->vbox); |
285 gtk_widget_hide(status_box->vbox); |
| 286 status_box->imhtml_visible = FALSE; |
286 status_box->imhtml_visible = FALSE; |
| 287 } |
287 } |
| 288 else |
288 else |
| 289 { |
289 { |
| 290 gtk_widget_show_all(status_box->vbox); |
290 gtk_widget_show_all(status_box->vbox); |
| 341 |
341 |
| 342 static void |
342 static void |
| 343 icon_box_dnd_cb(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, |
343 icon_box_dnd_cb(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, |
| 344 GtkSelectionData *sd, guint info, guint t, PidginStatusBox *box) |
344 GtkSelectionData *sd, guint info, guint t, PidginStatusBox *box) |
| 345 { |
345 { |
| 346 gchar *name = (gchar *)sd->data; |
346 gchar *name = (gchar *) gtk_selection_data_get_data(sd); |
| 347 |
347 |
| 348 if ((sd->length >= 0) && (sd->format == 8)) { |
348 if ((gtk_selection_data_get_length(sd) >= 0) |
| |
349 && (gtk_selection_data_get_format(sd) == 8)) { |
| 349 /* Well, it looks like the drag event was cool. |
350 /* Well, it looks like the drag event was cool. |
| 350 * Let's do something with it */ |
351 * Let's do something with it */ |
| 351 if (!g_ascii_strncasecmp(name, "file://", 7)) { |
352 if (!g_ascii_strncasecmp(name, "file://", 7)) { |
| 352 GError *converr = NULL; |
353 GError *converr = NULL; |
| 353 gchar *tmp, *rtmp; |
354 gchar *tmp, *rtmp; |
| 417 } |
418 } |
| 418 |
419 |
| 419 static gboolean |
420 static gboolean |
| 420 icon_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box) |
421 icon_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box) |
| 421 { |
422 { |
| 422 gdk_window_set_cursor(widget->window, box->hand_cursor); |
423 gdk_window_set_cursor(gtk_widget_get_window(widget), box->hand_cursor); |
| 423 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon_hover); |
424 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon_hover); |
| 424 return FALSE; |
425 return FALSE; |
| 425 } |
426 } |
| 426 |
427 |
| 427 static gboolean |
428 static gboolean |
| 428 icon_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box) |
429 icon_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box) |
| 429 { |
430 { |
| 430 gdk_window_set_cursor(widget->window, box->arrow_cursor); |
431 gdk_window_set_cursor(gtk_widget_get_window(widget), box->arrow_cursor); |
| 431 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon) ; |
432 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon) ; |
| 432 return FALSE; |
433 return FALSE; |
| 433 } |
434 } |
| 434 |
435 |
| 435 |
436 |
| 613 GtkContainerClass *container_class = (GtkContainerClass*)klass; |
614 GtkContainerClass *container_class = (GtkContainerClass*)klass; |
| 614 |
615 |
| 615 parent_class = g_type_class_peek_parent(klass); |
616 parent_class = g_type_class_peek_parent(klass); |
| 616 |
617 |
| 617 widget_class = (GtkWidgetClass*)klass; |
618 widget_class = (GtkWidgetClass*)klass; |
| 618 widget_class->size_request = pidgin_status_box_size_request; |
619 /* this seems to be removed in GTK+ 3...*/ |
| |
620 /*widget_class->size_request = pidgin_status_box_size_request;*/ |
| 619 widget_class->size_allocate = pidgin_status_box_size_allocate; |
621 widget_class->size_allocate = pidgin_status_box_size_allocate; |
| 620 widget_class->expose_event = pidgin_status_box_expose_event; |
622 /* this seems to be removed in GTK+ 3...*/ |
| |
623 /*widget_class->expose_event = pidgin_status_box_expose_event;*/ |
| 621 |
624 |
| 622 container_class->child_type = pidgin_status_box_child_type; |
625 container_class->child_type = pidgin_status_box_child_type; |
| 623 container_class->forall = pidgin_status_box_forall; |
626 container_class->forall = pidgin_status_box_forall; |
| 624 container_class->remove = NULL; |
627 container_class->remove = NULL; |
| 625 |
628 |
| 929 gtk_imhtml_clear_formatting(GTK_IMHTML(status_box->imhtml)); |
932 gtk_imhtml_clear_formatting(GTK_IMHTML(status_box->imhtml)); |
| 930 |
933 |
| 931 if (!purple_savedstatus_is_transient(saved_status) || !message || !*message) |
934 if (!purple_savedstatus_is_transient(saved_status) || !message || !*message) |
| 932 { |
935 { |
| 933 status_box->imhtml_visible = FALSE; |
936 status_box->imhtml_visible = FALSE; |
| 934 gtk_widget_hide_all(status_box->vbox); |
937 gtk_widget_hide(status_box->vbox); |
| 935 } |
938 } |
| 936 else |
939 else |
| 937 { |
940 { |
| 938 status_box->imhtml_visible = TRUE; |
941 status_box->imhtml_visible = TRUE; |
| 939 gtk_widget_show_all(status_box->vbox); |
942 gtk_widget_show_all(status_box->vbox); |
| 1133 return TRUE; |
1136 return TRUE; |
| 1134 } |
1137 } |
| 1135 |
1138 |
| 1136 static gboolean imhtml_remove_focus(GtkWidget *w, GdkEventKey *event, PidginStatusBox *status_box) |
1139 static gboolean imhtml_remove_focus(GtkWidget *w, GdkEventKey *event, PidginStatusBox *status_box) |
| 1137 { |
1140 { |
| 1138 if (event->keyval == GDK_Tab || event->keyval == GDK_KP_Tab || event->keyval == GDK_ISO_Left_Tab) |
1141 if (event->keyval == GDK_KEY_Tab || event->keyval == GDK_KEY_KP_Tab || event->keyval == GDK_KEY_ISO_Left_Tab) |
| 1139 { |
1142 { |
| 1140 /* If last inserted character is a tab, then remove the focus from here */ |
1143 /* If last inserted character is a tab, then remove the focus from here */ |
| 1141 GtkWidget *top = gtk_widget_get_toplevel(w); |
1144 GtkWidget *top = gtk_widget_get_toplevel(w); |
| 1142 g_signal_emit_by_name(G_OBJECT(top), "move_focus", |
1145 g_signal_emit_by_name(G_OBJECT(top), "move_focus", |
| 1143 (event->state & GDK_SHIFT_MASK) ? |
1146 (event->state & GDK_SHIFT_MASK) ? |
| 1146 } |
1149 } |
| 1147 if (status_box->typing == 0) |
1150 if (status_box->typing == 0) |
| 1148 return FALSE; |
1151 return FALSE; |
| 1149 |
1152 |
| 1150 /* Reset the status if Escape was pressed */ |
1153 /* Reset the status if Escape was pressed */ |
| 1151 if (event->keyval == GDK_Escape) |
1154 if (event->keyval == GDK_KEY_Escape) |
| 1152 { |
1155 { |
| 1153 purple_timeout_remove(status_box->typing); |
1156 purple_timeout_remove(status_box->typing); |
| 1154 status_box->typing = 0; |
1157 status_box->typing = 0; |
| 1155 gtk_imhtml_set_populate_primary_clipboard( |
1158 gtk_imhtml_set_populate_primary_clipboard( |
| 1156 GTK_IMHTML(status_box->imhtml), TRUE); |
1159 GTK_IMHTML(status_box->imhtml), TRUE); |
| 1297 GdkScreen *screen; |
1300 GdkScreen *screen; |
| 1298 gint monitor_num; |
1301 gint monitor_num; |
| 1299 GdkRectangle monitor; |
1302 GdkRectangle monitor; |
| 1300 GtkRequisition popup_req; |
1303 GtkRequisition popup_req; |
| 1301 GtkPolicyType hpolicy, vpolicy; |
1304 GtkPolicyType hpolicy, vpolicy; |
| 1302 |
1305 GtkAllocation allocation; |
| 1303 gdk_window_get_origin (GTK_WIDGET(status_box)->window, x, y); |
1306 |
| 1304 |
1307 gtk_widget_get_allocation(GTK_WIDGET(status_box), &allocation); |
| 1305 *x += GTK_WIDGET(status_box)->allocation.x; |
1308 gdk_window_get_origin (gtk_widget_get_window(GTK_WIDGET(status_box)), x, y); |
| 1306 *y += GTK_WIDGET(status_box)->allocation.y; |
1309 |
| 1307 |
1310 *x += allocation.x; |
| 1308 *width = GTK_WIDGET(status_box)->allocation.width; |
1311 *y += allocation.y; |
| |
1312 |
| |
1313 *width = allocation.width; |
| 1309 |
1314 |
| 1310 hpolicy = vpolicy = GTK_POLICY_NEVER; |
1315 hpolicy = vpolicy = GTK_POLICY_NEVER; |
| 1311 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (status_box->scrolled_window), |
1316 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (status_box->scrolled_window), |
| 1312 hpolicy, vpolicy); |
1317 hpolicy, vpolicy); |
| 1313 gtk_widget_size_request (status_box->popup_frame, &popup_req); |
1318 gtk_widget_size_request (status_box->popup_frame, &popup_req); |
| 1322 |
1327 |
| 1323 *height = popup_req.height; |
1328 *height = popup_req.height; |
| 1324 |
1329 |
| 1325 screen = gtk_widget_get_screen (GTK_WIDGET (status_box)); |
1330 screen = gtk_widget_get_screen (GTK_WIDGET (status_box)); |
| 1326 monitor_num = gdk_screen_get_monitor_at_window (screen, |
1331 monitor_num = gdk_screen_get_monitor_at_window (screen, |
| 1327 GTK_WIDGET (status_box)->window); |
1332 gtk_widget_get_window(GTK_WIDGET (status_box))); |
| 1328 gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); |
1333 gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); |
| 1329 |
1334 |
| 1330 if (*x < monitor.x) |
1335 if (*x < monitor.x) |
| 1331 *x = monitor.x; |
1336 *x = monitor.x; |
| 1332 else if (*x + *width > monitor.x + monitor.width) |
1337 else if (*x + *width > monitor.x + monitor.width) |
| 1333 *x = monitor.x + monitor.width - *width; |
1338 *x = monitor.x + monitor.width - *width; |
| 1334 |
1339 |
| 1335 if (*y + GTK_WIDGET(status_box)->allocation.height + *height <= monitor.y + monitor.height) |
1340 if (*y + allocation.height + *height <= monitor.y + monitor.height) |
| 1336 *y += GTK_WIDGET(status_box)->allocation.height; |
1341 *y += allocation.height; |
| 1337 else if (*y - *height >= monitor.y) |
1342 else if (*y - *height >= monitor.y) |
| 1338 *y -= *height; |
1343 *y -= *height; |
| 1339 else if (monitor.y + monitor.height - (*y + GTK_WIDGET(status_box)->allocation.height) > *y - monitor.y) |
1344 else if (monitor.y + monitor.height - (*y + allocation.height) > *y - monitor.y) |
| 1340 { |
1345 { |
| 1341 *y += GTK_WIDGET(status_box)->allocation.height; |
1346 *y += allocation.height; |
| 1342 *height = monitor.y + monitor.height - *y; |
1347 *height = monitor.y + monitor.height - *y; |
| 1343 } |
1348 } |
| 1344 else |
1349 else |
| 1345 { |
1350 { |
| 1346 *height = *y - monitor.y; |
1351 *height = *y - monitor.y; |
| 1367 NULL, NULL, activate_time) == 0)) |
1372 NULL, NULL, activate_time) == 0)) |
| 1368 { |
1373 { |
| 1369 if (!grab_keyboard || gdk_keyboard_grab (window, TRUE, activate_time) == 0) |
1374 if (!grab_keyboard || gdk_keyboard_grab (window, TRUE, activate_time) == 0) |
| 1370 return TRUE; |
1375 return TRUE; |
| 1371 else { |
1376 else { |
| 1372 gdk_display_pointer_ungrab (gdk_drawable_get_display (window), activate_time); |
1377 gdk_display_pointer_ungrab (gdk_window_get_display (window), activate_time); |
| 1373 return FALSE; |
1378 return FALSE; |
| 1374 } |
1379 } |
| 1375 } |
1380 } |
| 1376 |
1381 |
| 1377 return FALSE; |
1382 return FALSE; |
| 1386 |
1391 |
| 1387 gtk_widget_set_size_request (box->popup_window, width, height); |
1392 gtk_widget_set_size_request (box->popup_window, width, height); |
| 1388 gtk_window_move (GTK_WINDOW (box->popup_window), x, y); |
1393 gtk_window_move (GTK_WINDOW (box->popup_window), x, y); |
| 1389 gtk_widget_show(box->popup_window); |
1394 gtk_widget_show(box->popup_window); |
| 1390 gtk_widget_grab_focus (box->tree_view); |
1395 gtk_widget_grab_focus (box->tree_view); |
| 1391 if (!popup_grab_on_window (box->popup_window->window, |
1396 if (!popup_grab_on_window (gtk_widget_get_window(box->popup_window), |
| 1392 GDK_CURRENT_TIME, TRUE)) { |
1397 GDK_CURRENT_TIME, TRUE)) { |
| 1393 gtk_widget_hide (box->popup_window); |
1398 gtk_widget_hide (box->popup_window); |
| 1394 return; |
1399 return; |
| 1395 } |
1400 } |
| 1396 gtk_grab_add (box->popup_window); |
1401 gtk_grab_add (box->popup_window); |
| 1417 |
1422 |
| 1418 static gboolean |
1423 static gboolean |
| 1419 toggle_key_press_cb(GtkWidget *widget, GdkEventKey *event, PidginStatusBox *box) |
1424 toggle_key_press_cb(GtkWidget *widget, GdkEventKey *event, PidginStatusBox *box) |
| 1420 { |
1425 { |
| 1421 switch (event->keyval) { |
1426 switch (event->keyval) { |
| 1422 case GDK_Return: |
1427 case GDK_KEY_Return: |
| 1423 case GDK_KP_Enter: |
1428 case GDK_KEY_KP_Enter: |
| 1424 case GDK_KP_Space: |
1429 case GDK_KEY_KP_Space: |
| 1425 case GDK_space: |
1430 case GDK_KEY_space: |
| 1426 if (!box->popup_in_progress) { |
1431 if (!box->popup_in_progress) { |
| 1427 pidgin_status_box_popup (box); |
1432 pidgin_status_box_popup (box); |
| 1428 box->popup_in_progress = TRUE; |
1433 box->popup_in_progress = TRUE; |
| 1429 } else { |
1434 } else { |
| 1430 pidgin_status_box_popdown(box); |
1435 pidgin_status_box_popdown(box); |
| 1652 static gboolean |
1657 static gboolean |
| 1653 treeview_key_press_event(GtkWidget *widget, |
1658 treeview_key_press_event(GtkWidget *widget, |
| 1654 GdkEventKey *event, PidginStatusBox *box) |
1659 GdkEventKey *event, PidginStatusBox *box) |
| 1655 { |
1660 { |
| 1656 if (box->popup_in_progress) { |
1661 if (box->popup_in_progress) { |
| 1657 if (event->keyval == GDK_Escape) { |
1662 if (event->keyval == GDK_KEY_Escape) { |
| 1658 pidgin_status_box_popdown(box); |
1663 pidgin_status_box_popdown(box); |
| 1659 return TRUE; |
1664 return TRUE; |
| 1660 } else { |
1665 } else { |
| 1661 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(box->tree_view)); |
1666 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(box->tree_view)); |
| 1662 GtkTreeIter iter; |
1667 GtkTreeIter iter; |
| 1663 GtkTreePath *path; |
1668 GtkTreePath *path; |
| 1664 |
1669 |
| 1665 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
1670 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
| 1666 gboolean ret = TRUE; |
1671 gboolean ret = TRUE; |
| 1667 path = gtk_tree_model_get_path(GTK_TREE_MODEL(box->dropdown_store), &iter); |
1672 path = gtk_tree_model_get_path(GTK_TREE_MODEL(box->dropdown_store), &iter); |
| 1668 if (event->keyval == GDK_Return) { |
1673 if (event->keyval == GDK_KEY_Return) { |
| 1669 treeview_activate_current_selection(box, path); |
1674 treeview_activate_current_selection(box, path); |
| 1670 } else if (event->keyval == GDK_Delete) { |
1675 } else if (event->keyval == GDK_KEY_Delete) { |
| 1671 tree_view_delete_current_selection(box, path); |
1676 tree_view_delete_current_selection(box, path); |
| 1672 } else |
1677 } else |
| 1673 ret = FALSE; |
1678 ret = FALSE; |
| 1674 |
1679 |
| 1675 gtk_tree_path_free (path); |
1680 gtk_tree_path_free (path); |
| 1741 GtkCellRenderer *emblem_rend; |
1746 GtkCellRenderer *emblem_rend; |
| 1742 GtkTextBuffer *buffer; |
1747 GtkTextBuffer *buffer; |
| 1743 GtkWidget *toplevel; |
1748 GtkWidget *toplevel; |
| 1744 GtkTreeSelection *sel; |
1749 GtkTreeSelection *sel; |
| 1745 |
1750 |
| 1746 GTK_WIDGET_SET_FLAGS (status_box, GTK_NO_WINDOW); |
1751 gtk_widget_set_has_window(GTK_WIDGET(status_box), FALSE); |
| 1747 status_box->imhtml_visible = FALSE; |
1752 status_box->imhtml_visible = FALSE; |
| 1748 status_box->network_available = purple_network_is_available(); |
1753 status_box->network_available = purple_network_is_available(); |
| 1749 status_box->connecting = FALSE; |
1754 status_box->connecting = FALSE; |
| 1750 status_box->typing = 0; |
1755 status_box->typing = 0; |
| 1751 status_box->toggle_button = gtk_toggle_button_new(); |
1756 status_box->toggle_button = gtk_toggle_button_new(); |
| 1925 purple_signal_connect(purple_get_core(), "uri-handler", status_box, |
1930 purple_signal_connect(purple_get_core(), "uri-handler", status_box, |
| 1926 PURPLE_CALLBACK(statusbox_uri_handler), status_box); |
1931 PURPLE_CALLBACK(statusbox_uri_handler), status_box); |
| 1927 |
1932 |
| 1928 } |
1933 } |
| 1929 |
1934 |
| |
1935 /* TODO: is this needed in GTK+ 3? */ |
| |
1936 #if 0 |
| 1930 static void |
1937 static void |
| 1931 pidgin_status_box_size_request(GtkWidget *widget, |
1938 pidgin_status_box_size_request(GtkWidget *widget, |
| 1932 GtkRequisition *requisition) |
1939 GtkRequisition *requisition) |
| 1933 { |
1940 { |
| 1934 GtkRequisition box_req; |
1941 GtkRequisition box_req; |
| 1935 gint border_width = GTK_CONTAINER (widget)->border_width; |
1942 gint border_width = gtk_container_get_border_width(GTK_CONTAINER (widget)); |
| 1936 |
1943 |
| 1937 gtk_widget_size_request(PIDGIN_STATUS_BOX(widget)->toggle_button, requisition); |
1944 gtk_widget_size_request(PIDGIN_STATUS_BOX(widget)->toggle_button, requisition); |
| 1938 |
1945 |
| 1939 /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */ |
1946 /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */ |
| 1940 requisition->height = MAX(requisition->height, 34); |
1947 requisition->height = MAX(requisition->height, 34); |
| 1945 if (box_req.height > 1) |
1952 if (box_req.height > 1) |
| 1946 requisition->height += box_req.height + border_width * 2; |
1953 requisition->height += box_req.height + border_width * 2; |
| 1947 |
1954 |
| 1948 requisition->width = 1; |
1955 requisition->width = 1; |
| 1949 } |
1956 } |
| |
1957 #endif |
| 1950 |
1958 |
| 1951 /* From gnome-panel */ |
1959 /* From gnome-panel */ |
| 1952 static void |
1960 static void |
| 1953 do_colorshift (GdkPixbuf *dest, GdkPixbuf *src, int shift) |
1961 do_colorshift (GdkPixbuf *dest, GdkPixbuf *src, int shift) |
| 1954 { |
1962 { |
| 1993 GtkAllocation *allocation) |
2001 GtkAllocation *allocation) |
| 1994 { |
2002 { |
| 1995 PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget); |
2003 PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget); |
| 1996 GtkRequisition req = {0,0}; |
2004 GtkRequisition req = {0,0}; |
| 1997 GtkAllocation parent_alc, box_alc, icon_alc; |
2005 GtkAllocation parent_alc, box_alc, icon_alc; |
| 1998 gint border_width = GTK_CONTAINER (widget)->border_width; |
2006 gint border_width = gtk_container_get_border_width(GTK_CONTAINER (widget)); |
| 1999 |
2007 |
| 2000 gtk_widget_size_request(status_box->toggle_button, &req); |
2008 gtk_widget_size_request(status_box->toggle_button, &req); |
| 2001 /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */ |
2009 /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */ |
| 2002 |
2010 |
| 2003 req.height = MAX(req.height, 34); |
2011 req.height = MAX(req.height, 34); |
| 2032 pidgin_status_box_redisplay_buddy_icon(status_box); |
2040 pidgin_status_box_redisplay_buddy_icon(status_box); |
| 2033 } |
2041 } |
| 2034 gtk_widget_size_allocate(status_box->icon_box, &icon_alc); |
2042 gtk_widget_size_allocate(status_box->icon_box, &icon_alc); |
| 2035 } |
2043 } |
| 2036 gtk_widget_size_allocate(status_box->toggle_button, &parent_alc); |
2044 gtk_widget_size_allocate(status_box->toggle_button, &parent_alc); |
| 2037 widget->allocation = *allocation; |
2045 gtk_widget_set_allocation(GTK_WIDGET(status_box), allocation); |
| 2038 } |
2046 } |
| 2039 |
2047 |
| |
2048 /* TODO: don't think this is nessesary in GTK+ 3 */ |
| |
2049 #if 0 |
| 2040 static gboolean |
2050 static gboolean |
| 2041 pidgin_status_box_expose_event(GtkWidget *widget, |
2051 pidgin_status_box_expose_event(GtkWidget *widget, |
| 2042 GdkEventExpose *event) |
2052 GdkEventExpose *event) |
| 2043 { |
2053 { |
| 2044 PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget); |
2054 PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget); |
| 2049 status_box->icon_box, "button", status_box->icon_box->allocation.x-1, status_box->icon_box->allocation.y-1, |
2059 status_box->icon_box, "button", status_box->icon_box->allocation.x-1, status_box->icon_box->allocation.y-1, |
| 2050 34, 34); |
2060 34, 34); |
| 2051 } |
2061 } |
| 2052 return FALSE; |
2062 return FALSE; |
| 2053 } |
2063 } |
| |
2064 #endif |
| 2054 |
2065 |
| 2055 static void |
2066 static void |
| 2056 pidgin_status_box_forall(GtkContainer *container, |
2067 pidgin_status_box_forall(GtkContainer *container, |
| 2057 gboolean include_internals, |
2068 gboolean include_internals, |
| 2058 GtkCallback callback, |
2069 GtkCallback callback, |
| 2331 TITLE_COLUMN, &title, -1); |
2342 TITLE_COLUMN, &title, -1); |
| 2332 |
2343 |
| 2333 message = pidgin_status_box_get_message(status_box); |
2344 message = pidgin_status_box_get_message(status_box); |
| 2334 if (!message || !*message) |
2345 if (!message || !*message) |
| 2335 { |
2346 { |
| 2336 gtk_widget_hide_all(status_box->vbox); |
2347 gtk_widget_hide(status_box->vbox); |
| 2337 status_box->imhtml_visible = FALSE; |
2348 status_box->imhtml_visible = FALSE; |
| 2338 if (message != NULL) |
2349 if (message != NULL) |
| 2339 { |
2350 { |
| 2340 g_free(message); |
2351 g_free(message); |
| 2341 message = NULL; |
2352 message = NULL; |
| 2603 -1); |
2614 -1); |
| 2604 if ((wastyping = (status_box->typing != 0))) |
2615 if ((wastyping = (status_box->typing != 0))) |
| 2605 purple_timeout_remove(status_box->typing); |
2616 purple_timeout_remove(status_box->typing); |
| 2606 status_box->typing = 0; |
2617 status_box->typing = 0; |
| 2607 |
2618 |
| 2608 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) |
2619 if (gtk_widget_get_sensitive(GTK_WIDGET(status_box))) |
| 2609 { |
2620 { |
| 2610 if (type == PIDGIN_STATUS_BOX_TYPE_POPULAR || type == PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR) |
2621 if (type == PIDGIN_STATUS_BOX_TYPE_POPULAR || type == PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR) |
| 2611 { |
2622 { |
| 2612 PurpleSavedStatus *saved; |
2623 PurpleSavedStatus *saved; |
| 2613 saved = purple_savedstatus_find_by_creation_time(GPOINTER_TO_INT(data)); |
2624 saved = purple_savedstatus_find_by_creation_time(GPOINTER_TO_INT(data)); |
| 2665 break; |
2676 break; |
| 2666 } |
2677 } |
| 2667 } |
2678 } |
| 2668 g_list_free(accounts); |
2679 g_list_free(accounts); |
| 2669 |
2680 |
| 2670 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) |
2681 if (gtk_widget_get_sensitive(GTK_WIDGET(status_box))) |
| 2671 { |
2682 { |
| 2672 if (status_box->imhtml_visible) |
2683 if (status_box->imhtml_visible) |
| 2673 { |
2684 { |
| 2674 GtkTextIter start, end; |
2685 GtkTextIter start, end; |
| 2675 GtkTextBuffer *buffer; |
2686 GtkTextBuffer *buffer; |
| 2685 gtk_text_buffer_move_mark(buffer, gtk_text_buffer_get_mark(buffer, "insert"), &end); |
2696 gtk_text_buffer_move_mark(buffer, gtk_text_buffer_get_mark(buffer, "insert"), &end); |
| 2686 gtk_text_buffer_move_mark(buffer, gtk_text_buffer_get_mark(buffer, "selection_bound"), &start); |
2697 gtk_text_buffer_move_mark(buffer, gtk_text_buffer_get_mark(buffer, "selection_bound"), &start); |
| 2687 } |
2698 } |
| 2688 else |
2699 else |
| 2689 { |
2700 { |
| 2690 gtk_widget_hide_all(status_box->vbox); |
2701 gtk_widget_hide(status_box->vbox); |
| 2691 activate_currently_selected_status(status_box); /* This is where we actually set the status */ |
2702 activate_currently_selected_status(status_box); /* This is where we actually set the status */ |
| 2692 } |
2703 } |
| 2693 } |
2704 } |
| 2694 pidgin_status_box_refresh(status_box); |
2705 pidgin_status_box_refresh(status_box); |
| 2695 } |
2706 } |
| 2721 } |
2732 } |
| 2722 |
2733 |
| 2723 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data) |
2734 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data) |
| 2724 { |
2735 { |
| 2725 PidginStatusBox *status_box = (PidginStatusBox*)data; |
2736 PidginStatusBox *status_box = (PidginStatusBox*)data; |
| 2726 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) |
2737 if (gtk_widget_get_sensitive(GTK_WIDGET(status_box))) |
| 2727 { |
2738 { |
| 2728 if (status_box->typing != 0) { |
2739 if (status_box->typing != 0) { |
| 2729 pidgin_status_box_pulse_typing(status_box); |
2740 pidgin_status_box_pulse_typing(status_box); |
| 2730 purple_timeout_remove(status_box->typing); |
2741 purple_timeout_remove(status_box->typing); |
| 2731 } |
2742 } |