Mercurial > pidgin
changeset 29726:4e7a9940627e
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
for a few things that aren't in GTK+ releases yet.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Tue, 13 Apr 2010 23:22:31 +0000 |
parents | 823c3917d533 |
children | 3bb9bef6ac23 |
files | pidgin/plugins/convcolors.c pidgin/plugins/disco/gtkdisco.c pidgin/plugins/gestures/stroke-draw.c pidgin/plugins/notify.c pidgin/plugins/pidginrc.c pidgin/plugins/themeedit.c pidgin/plugins/ticker/gtkticker.c pidgin/plugins/timestamp_format.c pidgin/plugins/xmppconsole.c |
diffstat | 9 files changed, 209 insertions(+), 52 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/plugins/convcolors.c Tue Apr 13 22:29:02 2010 +0000 +++ b/pidgin/plugins/convcolors.c Tue Apr 13 23:22:31 2010 +0000 @@ -198,7 +198,12 @@ { if (response == GTK_RESPONSE_OK) { +#if GTK_CHECK_VERSION(2,14,0) + GtkWidget *colorsel = + gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(color_dialog)); +#else GtkWidget *colorsel = GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel; +#endif GdkColor color; char colorstr[8]; char tmp[128]; @@ -232,8 +237,15 @@ g_snprintf(tmp, sizeof(tmp), "%s/color", data); if (gdk_color_parse(purple_prefs_get_string(tmp), &color)) { +#if GTK_CHECK_VERSION(2,14,0) + gtk_color_selection_set_current_color(GTK_COLOR_SELECTION( + gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(color_dialog))), + &color); +#else gtk_color_selection_set_current_color( - GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel), &color); + GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel), + &color); +#endif } gtk_window_present(GTK_WINDOW(color_dialog));
--- a/pidgin/plugins/disco/gtkdisco.c Tue Apr 13 22:29:02 2010 +0000 +++ b/pidgin/plugins/disco/gtkdisco.c Tue Apr 13 23:22:31 2010 +0000 @@ -430,7 +430,13 @@ disco_paint_tooltip(GtkWidget *tipwindow, gpointer data) { PangoLayout *layout = g_object_get_data(G_OBJECT(tipwindow), "tooltip-plugin"); +#if GTK_CHECK_VERSION(2,14,0) + gtk_paint_layout(gtk_widget_get_style(tipwindow), + gtk_widget_get_window(tipwindow), + GTK_STATE_NORMAL, FALSE, +#else gtk_paint_layout(tipwindow->style, tipwindow->window, GTK_STATE_NORMAL, FALSE, +#endif NULL, tipwindow, "tooltip", 6, 6, layout); return TRUE;
--- a/pidgin/plugins/gestures/stroke-draw.c Tue Apr 13 22:29:02 2010 +0000 +++ b/pidgin/plugins/gestures/stroke-draw.c Tue Apr 13 23:22:31 2010 +0000 @@ -19,6 +19,9 @@ #include <X11/Xlib.h> #include <X11/Xutil.h> +#if !GTK_CHECK_VERSION(2,14,0) +#define gtk_widget_get_window(x) x->window +#endif static void gstroke_invisible_window_init (GtkWidget *widget); /*FIXME: Maybe these should be put in a structure, and not static...*/ @@ -75,7 +78,8 @@ /* FIXME: this does not work. It will only work if we create a corresponding GDK window for stroke_window and draw on that... */ - gdk_draw_line (widget->window, widget->style->fg_gc[GTK_STATE_NORMAL], + gdk_draw_line (gtk_widget_get_window(widget), + widget->style->fg_gc[GTK_STATE_NORMAL], last_mouse_position.last_point.x, last_mouse_position.last_point.y, x, @@ -156,7 +160,7 @@ if (cursor == NULL) cursor = gdk_cursor_new(GDK_PENCIL); - gdk_pointer_grab (widget->window, FALSE, + gdk_pointer_grab (gtk_widget_get_window(widget), FALSE, GDK_BUTTON_RELEASE_MASK, NULL, cursor, event->button.time); timer_id = g_timeout_add (GSTROKE_TIMEOUT_DURATION, @@ -334,8 +338,8 @@ unsigned long mask, col_border, col_background; unsigned int border_width; XSizeHints hints; - Display *disp = GDK_WINDOW_XDISPLAY(widget->window); - Window wind = GDK_WINDOW_XWINDOW (widget->window); + Display *disp = GDK_WINDOW_XDISPLAY(gtk_widget_get_window(widget)); + Window wind = GDK_WINDOW_XWINDOW (gtk_widget_get_window(widget)); int screen = DefaultScreen (disp); if (!gstroke_draw_strokes())
--- a/pidgin/plugins/notify.c Tue Apr 13 22:29:02 2010 +0000 +++ b/pidgin/plugins/notify.c Tue Apr 13 23:22:31 2010 +0000 @@ -547,7 +547,11 @@ } count = count_messages(purplewin); +#if GTK_CHECK_VERSION(2,14,0) + gdkwin = gtk_widget_get_window(window); +#else gdkwin = window->window; +#endif gdk_property_change(gdkwin, _PurpleUnseenCount, _Cardinal, 32, GDK_PROP_MODE_REPLACE, (guchar *) &count, 1);
--- a/pidgin/plugins/pidginrc.c Tue Apr 13 22:29:02 2010 +0000 +++ b/pidgin/plugins/pidginrc.c Tue Apr 13 23:22:31 2010 +0000 @@ -242,7 +242,12 @@ if (response == GTK_RESPONSE_OK) { GdkColor color; gchar colorstr[8]; +#if GTK_CHECK_VERSION(2,14,0) + GtkWidget *colorsel = + gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(color_dialog)); +#else GtkWidget *colorsel = GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel; +#endif gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(colorsel), &color); @@ -273,7 +278,13 @@ if (pref != NULL && strcmp(pref, "")) { if (gdk_color_parse(pref, &color)) { +#if GTK_CHECK_VERSION(2,14,0) + gtk_color_selection_set_current_color(GTK_COLOR_SELECTION( + gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(color_dialog))), + &color); +#else gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(color_dialog)->colorsel), &color); +#endif } } @@ -327,7 +338,7 @@ pref = purple_prefs_get_string(prefpath); if (pref != NULL && strcmp(pref, "")) { - gtk_font_selection_set_font_name(GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(font_dialog)->fontsel), pref); + gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(font_dialog), pref); } gtk_window_present(GTK_WINDOW(font_dialog));
--- a/pidgin/plugins/themeedit.c Tue Apr 13 22:29:02 2010 +0000 +++ b/pidgin/plugins/themeedit.c Tue Apr 13 23:22:31 2010 +0000 @@ -61,10 +61,17 @@ theme_color_selected(GtkDialog *dialog, gint response, const char *prop) { if (response == GTK_RESPONSE_OK) { + GtkWidget *colorsel; GdkColor color; PidginBlistTheme *theme; - gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(dialog)->colorsel), &color); +#if GTK_CHECK_VERSION(2,14,0) + colorsel = + gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(dialog)); +#else + colorsel = GTK_COLOR_SELECTION_DIALOG(dialog)->colorsel; +#endif + gtk_color_selection_get_current_color(GTK_COLOR_SELECTION(colorsel), &color); theme = pidgin_blist_get_theme(); @@ -119,7 +126,7 @@ face = pidgin_theme_font_get_font_face(font); dialog = gtk_font_selection_dialog_new(_("Select Font")); if (face && *face) - gtk_font_selection_set_font_name(GTK_FONT_SELECTION(GTK_FONT_SELECTION_DIALOG(dialog)->fontsel), + gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(dialog), face); g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(theme_font_face_selected), font); @@ -145,9 +152,16 @@ } dialog = gtk_color_selection_dialog_new(_("Select Color")); +#if GTK_CHECK_VERSION(2,14,0) + if (color) + gtk_color_selection_set_current_color(GTK_COLOR_SELECTION( + gtk_color_selection_dialog_get_color_selection(GTK_COLOR_SELECTION_DIALOG(dialog))), + color); +#else if (color) gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(GTK_COLOR_SELECTION_DIALOG(dialog)->colorsel), color); +#endif g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(theme_color_selected), prop);
--- a/pidgin/plugins/ticker/gtkticker.c Tue Apr 13 22:29:02 2010 +0000 +++ b/pidgin/plugins/ticker/gtkticker.c Tue Apr 13 23:22:31 2010 +0000 @@ -21,9 +21,37 @@ * GtkTicker Copyright 2000 Syd Logan */ +/* FIXME: GTK+ deprecated GTK_WIDGET_MAPPED/REALIZED, but don't provide + accessor functions yet. */ +#undef GSEAL_ENABLE + #include "gtkticker.h" #include <gtk/gtk.h> +/* These don't seem to be in a release yet. See BZ #69872 */ +#define gtk_widget_is_mapped(x) GTK_WIDGET_MAPPED(x) +#define gtk_widget_is_realized(x) GTK_WIDGET_REALIZED(x) +#define gtk_widget_set_realized(x,y) do {\ + if (y) \ + GTK_WIDGET_SET_FLAGS(x, GTK_REALIZED); \ + else \ + GTK_WIDGET_UNSET_FLAGS(x, GTK_REALIZED); \ +} while(0) +#define gtk_widget_set_mapped(x,y) do {\ + if (y) \ + GTK_WIDGET_SET_FLAGS(x, GTK_MAPPED); \ + else \ + GTK_WIDGET_UNSET_FLAGS(x, GTK_MAPPED); \ +} while(0) + +#if !GTK_CHECK_VERSION(2,18,0) +#define gtk_widget_get_visible(x) GTK_WIDGET_VISIBLE(x) + +#if !GTK_CHECK_VERSION(2,14,0) +#define gtk_widget_get_window(x) x->window +#endif +#endif + static void gtk_ticker_compute_offsets (GtkTicker *ticker); static void gtk_ticker_class_init (GtkTickerClass *klass); static void gtk_ticker_init (GtkTicker *ticker); @@ -119,7 +147,11 @@ static void gtk_ticker_init (GtkTicker *ticker) { +#if GTK_CHECK_VERSION(2,18,0) + gtk_widget_set_has_window (GTK_WIDGET (ticker), TRUE); +#else GTK_WIDGET_UNSET_FLAGS (ticker, GTK_NO_WINDOW); +#endif ticker->interval = (guint) 200; ticker->scootch = (guint) 2; @@ -149,12 +181,13 @@ ticker->children = g_list_append (ticker->children, child_info); - if (GTK_WIDGET_REALIZED (ticker)) + if (gtk_widget_is_realized (ticker)) gtk_widget_realize (widget); - if (GTK_WIDGET_VISIBLE (ticker) && GTK_WIDGET_VISIBLE (widget)) + if (gtk_widget_get_visible (GTK_WIDGET (ticker)) && + gtk_widget_get_visible (widget)) { - if (GTK_WIDGET_MAPPED (ticker)) + if (gtk_widget_is_mapped (GTK_WIDGET (ticker))) gtk_widget_map (widget); gtk_widget_queue_resize (GTK_WIDGET (ticker)); @@ -213,7 +246,7 @@ { GtkTicker *ticker = (GtkTicker *) data; - if (GTK_WIDGET_VISIBLE (ticker)) + if (gtk_widget_get_visible (GTK_WIDGET (ticker))) gtk_widget_queue_resize (GTK_WIDGET (ticker)); return( TRUE ); @@ -255,7 +288,7 @@ g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_TICKER (widget)); - GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED); + gtk_widget_set_mapped (widget, TRUE); ticker = GTK_TICKER (widget); children = ticker->children; @@ -264,29 +297,42 @@ child = children->data; children = children->next; - if (GTK_WIDGET_VISIBLE (child->widget) && - !GTK_WIDGET_MAPPED (child->widget)) + if (gtk_widget_get_visible (child->widget) && + !gtk_widget_is_mapped (child->widget)) gtk_widget_map (child->widget); } - gdk_window_show (widget->window); + gdk_window_show (gtk_widget_get_window (widget)); } static void gtk_ticker_realize (GtkWidget *widget) { GdkWindowAttr attributes; gint attributes_mask; + GdkWindow *window; + GtkStyle *style; +#if GTK_CHECK_VERSION(2,18,0) + GtkAllocation allocation; +#endif g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_TICKER (widget)); - GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED); + gtk_widget_set_realized (widget, TRUE); attributes.window_type = GDK_WINDOW_CHILD; +#if GTK_CHECK_VERSION(2,18,0) + gtk_widget_get_allocation (widget, &allocation); + attributes.x = allocation.x; + attributes.y = allocation.y; + attributes.width = allocation.width; + attributes.height = allocation.height; +#else attributes.x = widget->allocation.x; attributes.y = widget->allocation.y; attributes.width = widget->allocation.width; attributes.height = widget->allocation.height; +#endif attributes.wclass = GDK_INPUT_OUTPUT; attributes.visual = gtk_widget_get_visual (widget); attributes.colormap = gtk_widget_get_colormap (widget); @@ -295,12 +341,23 @@ attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP; - widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), + window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask); - gdk_window_set_user_data (widget->window, widget); +#if GTK_CHECK_VERSION(2,14,0) + gtk_widget_set_window (widget, window); +#else + widget->window = window; +#endif + gdk_window_set_user_data (window, widget); - widget->style = gtk_style_attach (widget->style, widget->window); - gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL); +#if GTK_CHECK_VERSION(2,14,0) + style = gtk_widget_get_style (widget); + style = gtk_style_attach (style, window); + gtk_widget_set_style (widget, style); +#else + style = widget->style = gtk_style_attach (widget->style, window); +#endif + gtk_style_set_background (style, window, GTK_STATE_NORMAL); } static void gtk_ticker_size_request (GtkWidget *widget, GtkRequisition *requisition) @@ -309,6 +366,7 @@ GtkTickerChild *child; GList *children; GtkRequisition child_requisition; + guint border_width; g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_TICKER (widget)); @@ -324,7 +382,7 @@ child = children->data; children = children->next; - if (GTK_WIDGET_VISIBLE (child->widget)) + if (gtk_widget_get_visible (child->widget)) { gtk_widget_size_request (child->widget, &child_requisition); @@ -336,8 +394,9 @@ if ( requisition->width > ticker->spacing ) requisition->width -= ticker->spacing; - requisition->height += GTK_CONTAINER (ticker)->border_width * 2; - requisition->width += GTK_CONTAINER (ticker)->border_width * 2; + border_width = gtk_container_get_border_width (GTK_CONTAINER (ticker)); + requisition->height += border_width * 2; + requisition->width += border_width * 2; } static void gtk_ticker_compute_offsets (GtkTicker *ticker) @@ -350,16 +409,24 @@ g_return_if_fail (ticker != NULL); g_return_if_fail (GTK_IS_TICKER(ticker)); - border_width = GTK_CONTAINER (ticker)->border_width; + border_width = gtk_container_get_border_width (GTK_CONTAINER (ticker)); +#if GTK_CHECK_VERSION(2,18,0) + { + GtkAllocation allocation; + gtk_widget_get_allocation (GTK_WIDGET (ticker), &allocation); + ticker->width = allocation.width; + } +#else ticker->width = GTK_WIDGET(ticker)->allocation.width; +#endif ticker->total = 0; children = ticker->children; while (children) { child = children->data; child->x = 0; - if (GTK_WIDGET_VISIBLE (child->widget)) { + if (gtk_widget_get_visible (child->widget)) { gtk_widget_get_child_requisition (child->widget, &child_requisition); child->offset = ticker->total; ticker->total += @@ -386,22 +453,35 @@ ticker = GTK_TICKER (widget); +#if GTK_CHECK_VERSION(2,18,0) + { + GtkAllocation a; + gtk_widget_get_allocation (GTK_WIDGET (ticker), &a); + if ( a.width != ticker->width ) + ticker->dirty = TRUE; + } +#else if ( GTK_WIDGET(ticker)->allocation.width != ticker->width ) ticker->dirty = TRUE; +#endif if ( ticker->dirty == TRUE ) { gtk_ticker_compute_offsets( ticker ); } +#if GTK_CHECK_VERSION(2,18,0) + gtk_widget_set_allocation (widget, allocation); +#else widget->allocation = *allocation; - if (GTK_WIDGET_REALIZED (widget)) - gdk_window_move_resize (widget->window, +#endif + if (gtk_widget_is_realized (widget)) + gdk_window_move_resize (gtk_widget_get_window (widget), allocation->x, allocation->y, allocation->width, allocation->height); - border_width = GTK_CONTAINER (ticker)->border_width; + border_width = gtk_container_get_border_width (GTK_CONTAINER (ticker)); children = ticker->children; while (children) @@ -409,16 +489,16 @@ child = children->data; child->x -= ticker->scootch; - if (GTK_WIDGET_VISIBLE (child->widget)) { + if (gtk_widget_get_visible (child->widget)) { gtk_widget_get_child_requisition (child->widget, &child_requisition); child_allocation.width = child_requisition.width; child_allocation.x = child->offset + border_width + child->x; - if ( ( child_allocation.x + child_allocation.width ) < GTK_WIDGET(ticker)->allocation.x ) { - if ( ticker->total >= GTK_WIDGET(ticker)->allocation.width ) { - child->x += GTK_WIDGET(ticker)->allocation.x + GTK_WIDGET(ticker)->allocation.width + ( ticker->total - ( GTK_WIDGET(ticker)->allocation.x + GTK_WIDGET(ticker)->allocation.width ) ); + if ( ( child_allocation.x + child_allocation.width ) < allocation->x ) { + if ( ticker->total >= allocation->width ) { + child->x += allocation->x + allocation->width + ( ticker->total - ( allocation->x + allocation->width ) ); } else { - child->x += GTK_WIDGET(ticker)->allocation.x + GTK_WIDGET(ticker)->allocation.width; + child->x += allocation->x + allocation->width; } } child_allocation.y = border_width; @@ -469,7 +549,7 @@ if (child->widget == widget) { - gboolean was_visible = GTK_WIDGET_VISIBLE (widget); + gboolean was_visible = gtk_widget_get_visible (widget); gtk_widget_unparent (widget); @@ -477,7 +557,7 @@ g_list_free (children); g_free (child); - if (was_visible && GTK_WIDGET_VISIBLE (container)) + if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container))) gtk_widget_queue_resize (GTK_WIDGET (container)); break;
--- a/pidgin/plugins/timestamp_format.c Tue Apr 13 22:29:02 2010 +0000 +++ b/pidgin/plugins/timestamp_format.c Tue Apr 13 23:22:31 2010 +0000 @@ -122,7 +122,11 @@ GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); g_signal_connect_after(G_OBJECT(dialog), "response", G_CALLBACK(gtk_widget_destroy), dialog); +#if GTK_CHECK_VERSION(2,14,0) + gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), frame); +#else gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), frame); +#endif gtk_window_set_role(GTK_WINDOW(dialog), "plugin_config"); gtk_window_set_title(GTK_WINDOW(dialog), _(purple_plugin_get_name(plugin))); gtk_widget_show_all(dialog); @@ -141,8 +145,13 @@ if (!GTK_IS_IMHTML(view)) return TRUE; +#if GTK_CHECK_VERSION(2,14,0) + if (!gdk_window_get_pointer(gtk_widget_get_window(GTK_WIDGET(view)), &cx, &cy, NULL)) + return TRUE; +#else if (!gdk_window_get_pointer(GTK_WIDGET(view)->window, &cx, &cy, NULL)) return TRUE; +#endif buffer = gtk_text_view_get_buffer(view);
--- a/pidgin/plugins/xmppconsole.c Tue Apr 13 22:29:02 2010 +0000 +++ b/pidgin/plugins/xmppconsole.c Tue Apr 13 23:22:31 2010 +0000 @@ -258,7 +258,7 @@ static void iq_clicked_cb(GtkWidget *w, gpointer nul) { - GtkWidget *hbox, *to_entry, *label, *type_combo; + GtkWidget *vbox, *hbox, *to_entry, *label, *type_combo; GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); GtkTextIter iter; GtkTextBuffer *buffer; @@ -277,9 +277,14 @@ gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); +#if GTK_CHECK_VERSION(2,14,0) + vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); +#else + vbox = GTK_DIALOG(dialog)->vbox; +#endif hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("To:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -291,7 +296,7 @@ gtk_box_pack_start(GTK_BOX(hbox), to_entry, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("Type:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -305,7 +310,7 @@ gtk_combo_box_set_active(GTK_COMBO_BOX(type_combo), 0); gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); - gtk_widget_show_all(GTK_DIALOG(dialog)->vbox); + gtk_widget_show_all(vbox); result = gtk_dialog_run(GTK_DIALOG(dialog)); if (result != GTK_RESPONSE_ACCEPT) { @@ -334,6 +339,7 @@ static void presence_clicked_cb(GtkWidget *w, gpointer nul) { + GtkWidget *vbox; GtkWidget *hbox; GtkWidget *to_entry; GtkWidget *status_entry; @@ -359,9 +365,14 @@ gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); +#if GTK_CHECK_VERSION(2,14,0) + vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); +#else + vbox = GTK_DIALOG(dialog)->vbox; +#endif hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("To:"); gtk_size_group_add_widget(sg, label); @@ -373,7 +384,7 @@ gtk_box_pack_start(GTK_BOX(hbox), to_entry, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("Type:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_size_group_add_widget(sg, label); @@ -391,7 +402,7 @@ gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("Show:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_size_group_add_widget(sg, label); @@ -407,7 +418,7 @@ gtk_box_pack_start(GTK_BOX(hbox), show_combo, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("Status:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -419,7 +430,7 @@ gtk_box_pack_start(GTK_BOX(hbox), status_entry, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("Priority:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -430,7 +441,7 @@ gtk_spin_button_set_value(GTK_SPIN_BUTTON(priority_entry), 0); gtk_box_pack_start(GTK_BOX(hbox), priority_entry, FALSE, FALSE, 0); - gtk_widget_show_all(GTK_DIALOG(dialog)->vbox); + gtk_widget_show_all(vbox); result = gtk_dialog_run(GTK_DIALOG(dialog)); if (result != GTK_RESPONSE_ACCEPT) { @@ -486,6 +497,7 @@ static void message_clicked_cb(GtkWidget *w, gpointer nul) { + GtkWidget *vbox; GtkWidget *hbox; GtkWidget *to_entry; GtkWidget *body_entry; @@ -511,9 +523,14 @@ gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT); gtk_container_set_border_width(GTK_CONTAINER(dialog), 12); +#if GTK_CHECK_VERSION(2,14,0) + vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); +#else + vbox = GTK_DIALOG(dialog)->vbox; +#endif hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("To:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -525,7 +542,7 @@ gtk_box_pack_start(GTK_BOX(hbox), to_entry, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("Type:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_size_group_add_widget(sg, label); @@ -540,7 +557,7 @@ gtk_box_pack_start(GTK_BOX(hbox), type_combo, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("Body:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -552,7 +569,7 @@ gtk_box_pack_start(GTK_BOX(hbox), body_entry, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("Subject:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -564,7 +581,7 @@ gtk_box_pack_start(GTK_BOX(hbox), subject_entry, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 3); - gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new("Thread:"); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); @@ -575,7 +592,7 @@ gtk_entry_set_activates_default (GTK_ENTRY (thread_entry), TRUE); gtk_box_pack_start(GTK_BOX(hbox), thread_entry, FALSE, FALSE, 0); - gtk_widget_show_all(GTK_DIALOG(dialog)->vbox); + gtk_widget_show_all(vbox); result = gtk_dialog_run(GTK_DIALOG(dialog)); if (result != GTK_RESPONSE_ACCEPT) {