| 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_get_preferred_height (GtkWidget *widget, |
| |
86 gint *minimum_height, gint *natural_height); |
| 86 static void pidgin_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); |
87 static void pidgin_status_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); |
| 87 static gboolean pidgin_status_box_expose_event (GtkWidget *widget, GdkEventExpose *event); |
88 static gboolean pidgin_status_box_draw (GtkWidget *widget, cairo_t *cr); |
| 88 static void pidgin_status_box_redisplay_buddy_icon(PidginStatusBox *status_box); |
89 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); |
90 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); |
91 static void pidgin_status_box_popup(PidginStatusBox *box); |
| 91 static void pidgin_status_box_popdown(PidginStatusBox *box); |
92 static void pidgin_status_box_popdown(PidginStatusBox *box); |
| 92 |
93 |
| 280 |
281 |
| 281 message = purple_status_get_attr_string(newstatus, "message"); |
282 message = purple_status_get_attr_string(newstatus, "message"); |
| 282 |
283 |
| 283 if (!message || !*message) |
284 if (!message || !*message) |
| 284 { |
285 { |
| 285 gtk_widget_hide_all(status_box->vbox); |
286 gtk_widget_hide(status_box->vbox); |
| 286 status_box->imhtml_visible = FALSE; |
287 status_box->imhtml_visible = FALSE; |
| 287 } |
288 } |
| 288 else |
289 else |
| 289 { |
290 { |
| 290 gtk_widget_show_all(status_box->vbox); |
291 gtk_widget_show_all(status_box->vbox); |
| 341 |
342 |
| 342 static void |
343 static void |
| 343 icon_box_dnd_cb(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, |
344 icon_box_dnd_cb(GtkWidget *widget, GdkDragContext *dc, gint x, gint y, |
| 344 GtkSelectionData *sd, guint info, guint t, PidginStatusBox *box) |
345 GtkSelectionData *sd, guint info, guint t, PidginStatusBox *box) |
| 345 { |
346 { |
| 346 gchar *name = (gchar *)sd->data; |
347 gchar *name = (gchar *) gtk_selection_data_get_data(sd); |
| 347 |
348 |
| 348 if ((sd->length >= 0) && (sd->format == 8)) { |
349 if ((gtk_selection_data_get_length(sd) >= 0) |
| |
350 && (gtk_selection_data_get_format(sd) == 8)) { |
| 349 /* Well, it looks like the drag event was cool. |
351 /* Well, it looks like the drag event was cool. |
| 350 * Let's do something with it */ |
352 * Let's do something with it */ |
| 351 if (!g_ascii_strncasecmp(name, "file://", 7)) { |
353 if (!g_ascii_strncasecmp(name, "file://", 7)) { |
| 352 GError *converr = NULL; |
354 GError *converr = NULL; |
| 353 gchar *tmp, *rtmp; |
355 gchar *tmp, *rtmp; |
| 417 } |
419 } |
| 418 |
420 |
| 419 static gboolean |
421 static gboolean |
| 420 icon_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box) |
422 icon_box_enter_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box) |
| 421 { |
423 { |
| 422 gdk_window_set_cursor(widget->window, box->hand_cursor); |
424 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); |
425 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon_hover); |
| 424 return FALSE; |
426 return FALSE; |
| 425 } |
427 } |
| 426 |
428 |
| 427 static gboolean |
429 static gboolean |
| 428 icon_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box) |
430 icon_box_leave_cb(GtkWidget *widget, GdkEventCrossing *event, PidginStatusBox *box) |
| 429 { |
431 { |
| 430 gdk_window_set_cursor(widget->window, box->arrow_cursor); |
432 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) ; |
433 gtk_image_set_from_pixbuf(GTK_IMAGE(box->icon), box->buddy_icon) ; |
| 432 return FALSE; |
434 return FALSE; |
| 433 } |
435 } |
| 434 |
436 |
| 435 |
437 |
| 613 GtkContainerClass *container_class = (GtkContainerClass*)klass; |
615 GtkContainerClass *container_class = (GtkContainerClass*)klass; |
| 614 |
616 |
| 615 parent_class = g_type_class_peek_parent(klass); |
617 parent_class = g_type_class_peek_parent(klass); |
| 616 |
618 |
| 617 widget_class = (GtkWidgetClass*)klass; |
619 widget_class = (GtkWidgetClass*)klass; |
| 618 widget_class->size_request = pidgin_status_box_size_request; |
620 widget_class->get_preferred_height = pidgin_status_box_get_preferred_height; |
| 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 widget_class->draw = pidgin_status_box_draw; |
| 621 |
623 |
| 622 container_class->child_type = pidgin_status_box_child_type; |
624 container_class->child_type = pidgin_status_box_child_type; |
| 623 container_class->forall = pidgin_status_box_forall; |
625 container_class->forall = pidgin_status_box_forall; |
| 624 container_class->remove = NULL; |
626 container_class->remove = NULL; |
| 625 |
627 |
| 929 gtk_imhtml_clear_formatting(GTK_IMHTML(status_box->imhtml)); |
931 gtk_imhtml_clear_formatting(GTK_IMHTML(status_box->imhtml)); |
| 930 |
932 |
| 931 if (!purple_savedstatus_is_transient(saved_status) || !message || !*message) |
933 if (!purple_savedstatus_is_transient(saved_status) || !message || !*message) |
| 932 { |
934 { |
| 933 status_box->imhtml_visible = FALSE; |
935 status_box->imhtml_visible = FALSE; |
| 934 gtk_widget_hide_all(status_box->vbox); |
936 gtk_widget_hide(status_box->vbox); |
| 935 } |
937 } |
| 936 else |
938 else |
| 937 { |
939 { |
| 938 status_box->imhtml_visible = TRUE; |
940 status_box->imhtml_visible = TRUE; |
| 939 gtk_widget_show_all(status_box->vbox); |
941 gtk_widget_show_all(status_box->vbox); |
| 1133 return TRUE; |
1135 return TRUE; |
| 1134 } |
1136 } |
| 1135 |
1137 |
| 1136 static gboolean imhtml_remove_focus(GtkWidget *w, GdkEventKey *event, PidginStatusBox *status_box) |
1138 static gboolean imhtml_remove_focus(GtkWidget *w, GdkEventKey *event, PidginStatusBox *status_box) |
| 1137 { |
1139 { |
| 1138 if (event->keyval == GDK_Tab || event->keyval == GDK_KP_Tab || event->keyval == GDK_ISO_Left_Tab) |
1140 if (event->keyval == GDK_KEY_Tab || event->keyval == GDK_KEY_KP_Tab || event->keyval == GDK_KEY_ISO_Left_Tab) |
| 1139 { |
1141 { |
| 1140 /* If last inserted character is a tab, then remove the focus from here */ |
1142 /* If last inserted character is a tab, then remove the focus from here */ |
| 1141 GtkWidget *top = gtk_widget_get_toplevel(w); |
1143 GtkWidget *top = gtk_widget_get_toplevel(w); |
| 1142 g_signal_emit_by_name(G_OBJECT(top), "move_focus", |
1144 g_signal_emit_by_name(G_OBJECT(top), "move_focus", |
| 1143 (event->state & GDK_SHIFT_MASK) ? |
1145 (event->state & GDK_SHIFT_MASK) ? |
| 1146 } |
1148 } |
| 1147 if (status_box->typing == 0) |
1149 if (status_box->typing == 0) |
| 1148 return FALSE; |
1150 return FALSE; |
| 1149 |
1151 |
| 1150 /* Reset the status if Escape was pressed */ |
1152 /* Reset the status if Escape was pressed */ |
| 1151 if (event->keyval == GDK_Escape) |
1153 if (event->keyval == GDK_KEY_Escape) |
| 1152 { |
1154 { |
| 1153 purple_timeout_remove(status_box->typing); |
1155 purple_timeout_remove(status_box->typing); |
| 1154 status_box->typing = 0; |
1156 status_box->typing = 0; |
| 1155 gtk_imhtml_set_populate_primary_clipboard( |
1157 gtk_imhtml_set_populate_primary_clipboard( |
| 1156 GTK_IMHTML(status_box->imhtml), TRUE); |
1158 GTK_IMHTML(status_box->imhtml), TRUE); |
| 1297 GdkScreen *screen; |
1299 GdkScreen *screen; |
| 1298 gint monitor_num; |
1300 gint monitor_num; |
| 1299 GdkRectangle monitor; |
1301 GdkRectangle monitor; |
| 1300 GtkRequisition popup_req; |
1302 GtkRequisition popup_req; |
| 1301 GtkPolicyType hpolicy, vpolicy; |
1303 GtkPolicyType hpolicy, vpolicy; |
| 1302 |
1304 GtkAllocation allocation; |
| 1303 gdk_window_get_origin (GTK_WIDGET(status_box)->window, x, y); |
1305 |
| 1304 |
1306 gtk_widget_get_allocation(GTK_WIDGET(status_box), &allocation); |
| 1305 *x += GTK_WIDGET(status_box)->allocation.x; |
1307 gdk_window_get_origin (gtk_widget_get_window(GTK_WIDGET(status_box)), x, y); |
| 1306 *y += GTK_WIDGET(status_box)->allocation.y; |
1308 |
| 1307 |
1309 *x += allocation.x; |
| 1308 *width = GTK_WIDGET(status_box)->allocation.width; |
1310 *y += allocation.y; |
| |
1311 |
| |
1312 *width = allocation.width; |
| 1309 |
1313 |
| 1310 hpolicy = vpolicy = GTK_POLICY_NEVER; |
1314 hpolicy = vpolicy = GTK_POLICY_NEVER; |
| 1311 g_object_set(G_OBJECT(status_box->scrolled_window), |
1315 g_object_set(G_OBJECT(status_box->scrolled_window), |
| 1312 "hscrollbar-policy", hpolicy, |
1316 "hscrollbar-policy", hpolicy, |
| 1313 "vscrollbar-policy", vpolicy, |
1317 "vscrollbar-policy", vpolicy, |
| 1326 |
1330 |
| 1327 *height = popup_req.height; |
1331 *height = popup_req.height; |
| 1328 |
1332 |
| 1329 screen = gtk_widget_get_screen (GTK_WIDGET (status_box)); |
1333 screen = gtk_widget_get_screen (GTK_WIDGET (status_box)); |
| 1330 monitor_num = gdk_screen_get_monitor_at_window (screen, |
1334 monitor_num = gdk_screen_get_monitor_at_window (screen, |
| 1331 GTK_WIDGET (status_box)->window); |
1335 gtk_widget_get_window(GTK_WIDGET (status_box))); |
| 1332 gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); |
1336 gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); |
| 1333 |
1337 |
| 1334 if (*x < monitor.x) |
1338 if (*x < monitor.x) |
| 1335 *x = monitor.x; |
1339 *x = monitor.x; |
| 1336 else if (*x + *width > monitor.x + monitor.width) |
1340 else if (*x + *width > monitor.x + monitor.width) |
| 1337 *x = monitor.x + monitor.width - *width; |
1341 *x = monitor.x + monitor.width - *width; |
| 1338 |
1342 |
| 1339 if (*y + GTK_WIDGET(status_box)->allocation.height + *height <= monitor.y + monitor.height) |
1343 if (*y + allocation.height + *height <= monitor.y + monitor.height) |
| 1340 *y += GTK_WIDGET(status_box)->allocation.height; |
1344 *y += allocation.height; |
| 1341 else if (*y - *height >= monitor.y) |
1345 else if (*y - *height >= monitor.y) |
| 1342 *y -= *height; |
1346 *y -= *height; |
| 1343 else if (monitor.y + monitor.height - (*y + GTK_WIDGET(status_box)->allocation.height) > *y - monitor.y) |
1347 else if (monitor.y + monitor.height - (*y + allocation.height) > *y - monitor.y) |
| 1344 { |
1348 { |
| 1345 *y += GTK_WIDGET(status_box)->allocation.height; |
1349 *y += allocation.height; |
| 1346 *height = monitor.y + monitor.height - *y; |
1350 *height = monitor.y + monitor.height - *y; |
| 1347 } |
1351 } |
| 1348 else |
1352 else |
| 1349 { |
1353 { |
| 1350 *height = *y - monitor.y; |
1354 *height = *y - monitor.y; |
| 1373 NULL, NULL, activate_time) == 0)) |
1377 NULL, NULL, activate_time) == 0)) |
| 1374 { |
1378 { |
| 1375 if (!grab_keyboard || gdk_keyboard_grab (window, TRUE, activate_time) == 0) |
1379 if (!grab_keyboard || gdk_keyboard_grab (window, TRUE, activate_time) == 0) |
| 1376 return TRUE; |
1380 return TRUE; |
| 1377 else { |
1381 else { |
| 1378 gdk_display_pointer_ungrab (gdk_drawable_get_display (window), activate_time); |
1382 gdk_display_pointer_ungrab (gdk_window_get_display (window), activate_time); |
| 1379 return FALSE; |
1383 return FALSE; |
| 1380 } |
1384 } |
| 1381 } |
1385 } |
| 1382 |
1386 |
| 1383 return FALSE; |
1387 return FALSE; |
| 1392 |
1396 |
| 1393 gtk_widget_set_size_request (box->popup_window, width, height); |
1397 gtk_widget_set_size_request (box->popup_window, width, height); |
| 1394 gtk_window_move (GTK_WINDOW (box->popup_window), x, y); |
1398 gtk_window_move (GTK_WINDOW (box->popup_window), x, y); |
| 1395 gtk_widget_show(box->popup_window); |
1399 gtk_widget_show(box->popup_window); |
| 1396 gtk_widget_grab_focus (box->tree_view); |
1400 gtk_widget_grab_focus (box->tree_view); |
| 1397 if (!popup_grab_on_window (box->popup_window->window, |
1401 if (!popup_grab_on_window (gtk_widget_get_window(box->popup_window), |
| 1398 GDK_CURRENT_TIME, TRUE)) { |
1402 GDK_CURRENT_TIME, TRUE)) { |
| 1399 gtk_widget_hide (box->popup_window); |
1403 gtk_widget_hide (box->popup_window); |
| 1400 return; |
1404 return; |
| 1401 } |
1405 } |
| 1402 gtk_grab_add (box->popup_window); |
1406 gtk_grab_add (box->popup_window); |
| 1423 |
1427 |
| 1424 static gboolean |
1428 static gboolean |
| 1425 toggle_key_press_cb(GtkWidget *widget, GdkEventKey *event, PidginStatusBox *box) |
1429 toggle_key_press_cb(GtkWidget *widget, GdkEventKey *event, PidginStatusBox *box) |
| 1426 { |
1430 { |
| 1427 switch (event->keyval) { |
1431 switch (event->keyval) { |
| 1428 case GDK_Return: |
1432 case GDK_KEY_Return: |
| 1429 case GDK_KP_Enter: |
1433 case GDK_KEY_KP_Enter: |
| 1430 case GDK_KP_Space: |
1434 case GDK_KEY_KP_Space: |
| 1431 case GDK_space: |
1435 case GDK_KEY_space: |
| 1432 if (!box->popup_in_progress) { |
1436 if (!box->popup_in_progress) { |
| 1433 pidgin_status_box_popup (box); |
1437 pidgin_status_box_popup (box); |
| 1434 box->popup_in_progress = TRUE; |
1438 box->popup_in_progress = TRUE; |
| 1435 } else { |
1439 } else { |
| 1436 pidgin_status_box_popdown(box); |
1440 pidgin_status_box_popdown(box); |
| 1658 static gboolean |
1662 static gboolean |
| 1659 treeview_key_press_event(GtkWidget *widget, |
1663 treeview_key_press_event(GtkWidget *widget, |
| 1660 GdkEventKey *event, PidginStatusBox *box) |
1664 GdkEventKey *event, PidginStatusBox *box) |
| 1661 { |
1665 { |
| 1662 if (box->popup_in_progress) { |
1666 if (box->popup_in_progress) { |
| 1663 if (event->keyval == GDK_Escape) { |
1667 if (event->keyval == GDK_KEY_Escape) { |
| 1664 pidgin_status_box_popdown(box); |
1668 pidgin_status_box_popdown(box); |
| 1665 return TRUE; |
1669 return TRUE; |
| 1666 } else { |
1670 } else { |
| 1667 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(box->tree_view)); |
1671 GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(box->tree_view)); |
| 1668 GtkTreeIter iter; |
1672 GtkTreeIter iter; |
| 1669 GtkTreePath *path; |
1673 GtkTreePath *path; |
| 1670 |
1674 |
| 1671 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
1675 if (gtk_tree_selection_get_selected(sel, NULL, &iter)) { |
| 1672 gboolean ret = TRUE; |
1676 gboolean ret = TRUE; |
| 1673 path = gtk_tree_model_get_path(GTK_TREE_MODEL(box->dropdown_store), &iter); |
1677 path = gtk_tree_model_get_path(GTK_TREE_MODEL(box->dropdown_store), &iter); |
| 1674 if (event->keyval == GDK_Return) { |
1678 if (event->keyval == GDK_KEY_Return) { |
| 1675 treeview_activate_current_selection(box, path); |
1679 treeview_activate_current_selection(box, path); |
| 1676 } else if (event->keyval == GDK_Delete) { |
1680 } else if (event->keyval == GDK_KEY_Delete) { |
| 1677 tree_view_delete_current_selection(box, path); |
1681 tree_view_delete_current_selection(box, path); |
| 1678 } else |
1682 } else |
| 1679 ret = FALSE; |
1683 ret = FALSE; |
| 1680 |
1684 |
| 1681 gtk_tree_path_free (path); |
1685 gtk_tree_path_free (path); |
| 1747 GtkCellRenderer *emblem_rend; |
1751 GtkCellRenderer *emblem_rend; |
| 1748 GtkTextBuffer *buffer; |
1752 GtkTextBuffer *buffer; |
| 1749 GtkWidget *toplevel; |
1753 GtkWidget *toplevel; |
| 1750 GtkTreeSelection *sel; |
1754 GtkTreeSelection *sel; |
| 1751 |
1755 |
| 1752 GTK_WIDGET_SET_FLAGS (status_box, GTK_NO_WINDOW); |
1756 gtk_widget_set_has_window(GTK_WIDGET(status_box), FALSE); |
| 1753 status_box->imhtml_visible = FALSE; |
1757 status_box->imhtml_visible = FALSE; |
| 1754 status_box->network_available = purple_network_is_available(); |
1758 status_box->network_available = purple_network_is_available(); |
| 1755 status_box->connecting = FALSE; |
1759 status_box->connecting = FALSE; |
| 1756 status_box->typing = 0; |
1760 status_box->typing = 0; |
| 1757 status_box->toggle_button = gtk_toggle_button_new(); |
1761 status_box->toggle_button = gtk_toggle_button_new(); |
| 1923 PURPLE_CALLBACK(statusbox_uri_handler), status_box); |
1927 PURPLE_CALLBACK(statusbox_uri_handler), status_box); |
| 1924 |
1928 |
| 1925 } |
1929 } |
| 1926 |
1930 |
| 1927 static void |
1931 static void |
| 1928 pidgin_status_box_size_request(GtkWidget *widget, |
1932 pidgin_status_box_get_preferred_height(GtkWidget *widget, gint *minimum_height, |
| 1929 GtkRequisition *requisition) |
1933 gint *natural_height) |
| 1930 { |
1934 { |
| 1931 GtkRequisition box_req; |
1935 gint box_min_height, box_nat_height; |
| 1932 gint border_width = GTK_CONTAINER (widget)->border_width; |
1936 gint border_width = gtk_container_get_border_width(GTK_CONTAINER (widget)); |
| 1933 |
1937 |
| 1934 gtk_widget_size_request(PIDGIN_STATUS_BOX(widget)->toggle_button, requisition); |
1938 gtk_widget_get_preferred_height(PIDGIN_STATUS_BOX(widget)->toggle_button, |
| 1935 |
1939 minimum_height, natural_height); |
| 1936 /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */ |
1940 |
| 1937 requisition->height = MAX(requisition->height, 34); |
1941 *minimum_height = MAX(*minimum_height, 34) + border_width * 2; |
| 1938 requisition->height += border_width * 2; |
1942 *natural_height = MAX(*natural_height, 34) + border_width * 2; |
| 1939 |
1943 |
| 1940 /* If the gtkimhtml is visible, then add some additional padding */ |
1944 /* If the gtkimhtml is visible, then add some additional padding */ |
| 1941 gtk_widget_size_request(PIDGIN_STATUS_BOX(widget)->vbox, &box_req); |
1945 gtk_widget_get_preferred_height(PIDGIN_STATUS_BOX(widget)->vbox, |
| 1942 if (box_req.height > 1) |
1946 &box_min_height, &box_nat_height); |
| 1943 requisition->height += box_req.height + border_width * 2; |
1947 |
| 1944 |
1948 if (box_min_height > 1) |
| 1945 requisition->width = 1; |
1949 *minimum_height += box_min_height + border_width * 2; |
| |
1950 |
| |
1951 if (box_nat_height > 1) |
| |
1952 *natural_height += box_nat_height + border_width * 2; |
| 1946 } |
1953 } |
| 1947 |
1954 |
| 1948 /* From gnome-panel */ |
1955 /* From gnome-panel */ |
| 1949 static void |
1956 static void |
| 1950 do_colorshift (GdkPixbuf *dest, GdkPixbuf *src, int shift) |
1957 do_colorshift (GdkPixbuf *dest, GdkPixbuf *src, int shift) |
| 1988 static void |
1995 static void |
| 1989 pidgin_status_box_size_allocate(GtkWidget *widget, |
1996 pidgin_status_box_size_allocate(GtkWidget *widget, |
| 1990 GtkAllocation *allocation) |
1997 GtkAllocation *allocation) |
| 1991 { |
1998 { |
| 1992 PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget); |
1999 PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget); |
| 1993 GtkRequisition req = {0,0}; |
2000 GtkRequisition req = {0,40}; |
| 1994 GtkAllocation parent_alc, box_alc, icon_alc; |
2001 GtkAllocation parent_alc, box_alc, icon_alc; |
| 1995 gint border_width = GTK_CONTAINER (widget)->border_width; |
2002 gint border_width = gtk_container_get_border_width(GTK_CONTAINER (widget)); |
| 1996 |
2003 |
| 1997 gtk_widget_size_request(status_box->toggle_button, &req); |
2004 gtk_widget_size_request(status_box->toggle_button, &req); |
| 1998 /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */ |
2005 /* Make this icon the same size as other buddy icons in the list; unless it already wants to be bigger */ |
| 1999 |
2006 |
| 2000 req.height = MAX(req.height, 34); |
2007 req.height = MAX(req.height, 34); |
| 2029 pidgin_status_box_redisplay_buddy_icon(status_box); |
2036 pidgin_status_box_redisplay_buddy_icon(status_box); |
| 2030 } |
2037 } |
| 2031 gtk_widget_size_allocate(status_box->icon_box, &icon_alc); |
2038 gtk_widget_size_allocate(status_box->icon_box, &icon_alc); |
| 2032 } |
2039 } |
| 2033 gtk_widget_size_allocate(status_box->toggle_button, &parent_alc); |
2040 gtk_widget_size_allocate(status_box->toggle_button, &parent_alc); |
| 2034 widget->allocation = *allocation; |
2041 gtk_widget_set_allocation(GTK_WIDGET(status_box), allocation); |
| |
2042 purple_debug_info("pidgin", "statusbox allocation: width = %d, height = %d\n", |
| |
2043 allocation->width, allocation->height); |
| 2035 } |
2044 } |
| 2036 |
2045 |
| 2037 static gboolean |
2046 static gboolean |
| 2038 pidgin_status_box_expose_event(GtkWidget *widget, |
2047 pidgin_status_box_draw(GtkWidget *widget, cairo_t *cr) |
| 2039 GdkEventExpose *event) |
|
| 2040 { |
2048 { |
| 2041 PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget); |
2049 PidginStatusBox *status_box = PIDGIN_STATUS_BOX(widget); |
| 2042 gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->vbox, event); |
2050 gtk_widget_draw(status_box->vbox, cr); |
| 2043 gtk_container_propagate_expose(GTK_CONTAINER(widget), status_box->toggle_button, event); |
2051 gtk_widget_draw(status_box->toggle_button, cr); |
| |
2052 |
| 2044 if (status_box->icon_box && status_box->icon_opaque) { |
2053 if (status_box->icon_box && status_box->icon_opaque) { |
| 2045 gtk_paint_box(widget->style, widget->window, GTK_STATE_NORMAL, GTK_SHADOW_OUT, NULL, |
2054 GtkAllocation allocation; |
| 2046 status_box->icon_box, "button", status_box->icon_box->allocation.x-1, status_box->icon_box->allocation.y-1, |
2055 |
| |
2056 gtk_widget_get_allocation(status_box->icon_box, &allocation); |
| |
2057 gtk_paint_box(gtk_widget_get_style(widget), cr, GTK_STATE_NORMAL, GTK_SHADOW_OUT, |
| |
2058 status_box->icon_box, "button", allocation.x-1, allocation.y-1, |
| 2047 34, 34); |
2059 34, 34); |
| 2048 } |
2060 } |
| 2049 return FALSE; |
2061 return FALSE; |
| 2050 } |
2062 } |
| 2051 |
2063 |
| 2351 TITLE_COLUMN, &title, -1); |
2363 TITLE_COLUMN, &title, -1); |
| 2352 |
2364 |
| 2353 message = pidgin_status_box_get_message(status_box); |
2365 message = pidgin_status_box_get_message(status_box); |
| 2354 if (!message || !*message) |
2366 if (!message || !*message) |
| 2355 { |
2367 { |
| 2356 gtk_widget_hide_all(status_box->vbox); |
2368 gtk_widget_hide(status_box->vbox); |
| 2357 status_box->imhtml_visible = FALSE; |
2369 status_box->imhtml_visible = FALSE; |
| 2358 if (message != NULL) |
2370 if (message != NULL) |
| 2359 { |
2371 { |
| 2360 g_free(message); |
2372 g_free(message); |
| 2361 message = NULL; |
2373 message = NULL; |
| 2623 -1); |
2635 -1); |
| 2624 if ((wastyping = (status_box->typing != 0))) |
2636 if ((wastyping = (status_box->typing != 0))) |
| 2625 purple_timeout_remove(status_box->typing); |
2637 purple_timeout_remove(status_box->typing); |
| 2626 status_box->typing = 0; |
2638 status_box->typing = 0; |
| 2627 |
2639 |
| 2628 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) |
2640 if (gtk_widget_get_sensitive(GTK_WIDGET(status_box))) |
| 2629 { |
2641 { |
| 2630 if (type == PIDGIN_STATUS_BOX_TYPE_POPULAR || type == PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR) |
2642 if (type == PIDGIN_STATUS_BOX_TYPE_POPULAR || type == PIDGIN_STATUS_BOX_TYPE_SAVED_POPULAR) |
| 2631 { |
2643 { |
| 2632 PurpleSavedStatus *saved; |
2644 PurpleSavedStatus *saved; |
| 2633 saved = purple_savedstatus_find_by_creation_time(GPOINTER_TO_INT(data)); |
2645 saved = purple_savedstatus_find_by_creation_time(GPOINTER_TO_INT(data)); |
| 2685 break; |
2697 break; |
| 2686 } |
2698 } |
| 2687 } |
2699 } |
| 2688 g_list_free(accounts); |
2700 g_list_free(accounts); |
| 2689 |
2701 |
| 2690 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) |
2702 if (gtk_widget_get_sensitive(GTK_WIDGET(status_box))) |
| 2691 { |
2703 { |
| 2692 if (status_box->imhtml_visible) |
2704 if (status_box->imhtml_visible) |
| 2693 { |
2705 { |
| 2694 GtkTextIter start, end; |
2706 GtkTextIter start, end; |
| 2695 GtkTextBuffer *buffer; |
2707 GtkTextBuffer *buffer; |
| 2705 gtk_text_buffer_move_mark(buffer, gtk_text_buffer_get_mark(buffer, "insert"), &end); |
2717 gtk_text_buffer_move_mark(buffer, gtk_text_buffer_get_mark(buffer, "insert"), &end); |
| 2706 gtk_text_buffer_move_mark(buffer, gtk_text_buffer_get_mark(buffer, "selection_bound"), &start); |
2718 gtk_text_buffer_move_mark(buffer, gtk_text_buffer_get_mark(buffer, "selection_bound"), &start); |
| 2707 } |
2719 } |
| 2708 else |
2720 else |
| 2709 { |
2721 { |
| 2710 gtk_widget_hide_all(status_box->vbox); |
2722 gtk_widget_hide(status_box->vbox); |
| 2711 activate_currently_selected_status(status_box); /* This is where we actually set the status */ |
2723 activate_currently_selected_status(status_box); /* This is where we actually set the status */ |
| 2712 } |
2724 } |
| 2713 } |
2725 } |
| 2714 pidgin_status_box_refresh(status_box); |
2726 pidgin_status_box_refresh(status_box); |
| 2715 } |
2727 } |
| 2741 } |
2753 } |
| 2742 |
2754 |
| 2743 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data) |
2755 static void imhtml_changed_cb(GtkTextBuffer *buffer, void *data) |
| 2744 { |
2756 { |
| 2745 PidginStatusBox *status_box = (PidginStatusBox*)data; |
2757 PidginStatusBox *status_box = (PidginStatusBox*)data; |
| 2746 if (GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(status_box))) |
2758 if (gtk_widget_get_sensitive(GTK_WIDGET(status_box))) |
| 2747 { |
2759 { |
| 2748 if (status_box->typing != 0) { |
2760 if (status_box->typing != 0) { |
| 2749 pidgin_status_box_pulse_typing(status_box); |
2761 pidgin_status_box_pulse_typing(status_box); |
| 2750 purple_timeout_remove(status_box->typing); |
2762 purple_timeout_remove(status_box->typing); |
| 2751 } |
2763 } |