[dia] Handle new deprecations of gtk-2.21 (except gdk_draw_*)



commit 9882262b6e41aa17eaaab01ddb46729b9ecefdf0
Author: Hans Breuer <hans breuer org>
Date:   Fri Aug 13 18:49:54 2010 +0200

    Handle new deprecations of gtk-2.21 (except gdk_draw_*)
    
    There are still a bunch of long-time deprecated widgets in use.
    And there is huge new deprecation in current Gtk+, where I'm
    uncertain about the impact on moving Dia further towards Gtk+3.
    See https://bugzilla.gnome.org/show_bug.cgi?id=624255

 app/app_procs.c                        |    4 ++++
 app/diacanvas.c                        |    4 ++++
 app/disp_callbacks.c                   |    8 ++++++++
 app/display.c                          |    4 ++++
 app/gtkwrapbox.c                       |   12 ++++++++++++
 app/interface.c                        |    4 ++++
 app/layer_dialog.c                     |    8 ++++++++
 app/menus.c                            |    6 ++++++
 app/sheets_dialog.c                    |    8 ++++++++
 lib/diaarrowchooser.c                  |    4 ++++
 lib/dialinechooser.c                   |    4 ++++
 lib/widgets.c                          |    8 ++++++++
 objects/AADL/edit_port_declaration.c   |    4 ++++
 plug-ins/postscript/paginate_psprint.c |    8 ++++++++
 14 files changed, 86 insertions(+), 0 deletions(-)
---
diff --git a/app/app_procs.c b/app/app_procs.c
index 42645be..7e85ad4 100644
--- a/app/app_procs.c
+++ b/app/app_procs.c
@@ -1107,7 +1107,11 @@ app_exit(void)
   
     button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
     gtk_dialog_add_action_widget (GTK_DIALOG(dialog), button, GTK_RESPONSE_CANCEL);
+#if GTK_CHECK_VERSION(2,18,0)
+    gtk_widget_set_can_default (GTK_WIDGET (button), TRUE);
+#else
     GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+#endif
     gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL);
 
     button = gtk_button_new_from_stock (GTK_STOCK_QUIT);
diff --git a/app/diacanvas.c b/app/diacanvas.c
index e5be940..b66fc1d 100644
--- a/app/diacanvas.c
+++ b/app/diacanvas.c
@@ -338,7 +338,11 @@ dia_canvas_realize (GtkWidget *widget)
   GdkWindowAttr attributes;
   gint attributes_mask;
 
+#if GTK_CHECK_VERSION(2,20,0)
+  gtk_widget_set_realized (GTK_WIDGET (widget), TRUE);
+#else
   GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+#endif
 
   attributes.window_type = GDK_WINDOW_CHILD;
   attributes.x = widget->allocation.x;
diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c
index b9a25fd..52f3d2e 100644
--- a/app/disp_callbacks.c
+++ b/app/disp_callbacks.c
@@ -325,7 +325,11 @@ ddisplay_focus_in_event(GtkWidget *widget, GdkEventFocus *event, gpointer data)
 
   ddisp = (DDisplay *)data;
 
+#if GTK_CHECK_VERSION(2,21,6)
+  g_assert (event->in == TRUE);
+#else
   GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS);
+#endif
 
   gtk_im_context_focus_in(GTK_IM_CONTEXT(ddisp->im_context));
   
@@ -346,7 +350,11 @@ ddisplay_focus_out_event(GtkWidget *widget, GdkEventFocus *event,gpointer data)
 
   ddisp = (DDisplay *)data;
 
+#if GTK_CHECK_VERSION(2,21,6)
+  g_assert (event->in == FALSE);
+#else
   GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
+#endif
 
   gtk_im_context_focus_out(GTK_IM_CONTEXT(ddisp->im_context));
 
diff --git a/app/display.c b/app/display.c
index 2300202..806fa6b 100644
--- a/app/display.c
+++ b/app/display.c
@@ -1280,7 +1280,11 @@ ddisplay_close(DDisplay *ddisp)
   /* button = gtk_button_new_with_label (_("Save and Close")); */
   button = gtk_button_new_from_stock (GTK_STOCK_SAVE);
   gtk_dialog_add_action_widget (GTK_DIALOG(dialog), button, GTK_RESPONSE_YES);
+#if GTK_CHECK_VERSION(2,18,0)
+  gtk_widget_set_can_default (GTK_WIDGET (button), TRUE);
+#else
   GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+#endif
   gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_YES);
 
   g_signal_connect (G_OBJECT (dialog), "response",
diff --git a/app/gtkwrapbox.c b/app/gtkwrapbox.c
index 05152d7..6043de0 100644
--- a/app/gtkwrapbox.c
+++ b/app/gtkwrapbox.c
@@ -268,7 +268,11 @@ gtk_wrap_box_class_init (GtkWrapBoxClass *class)
 static void
 gtk_wrap_box_init (GtkWrapBox *wbox)
 {
+#if GTK_CHECK_VERSION(2,18,0)
+  gtk_widget_set_has_window (GTK_WIDGET (wbox), FALSE);
+#else
   GTK_WIDGET_SET_FLAGS (wbox, GTK_NO_WINDOW);
+#endif
 
   wbox->homogeneous = FALSE;
   wbox->hspacing = 0;
@@ -829,7 +833,11 @@ gtk_wrap_box_map (GtkWidget *widget)
   GtkWrapBox *wbox = GTK_WRAP_BOX (widget);
   GtkWrapBoxChild *child;
 
+#if GTK_CHECK_VERSION(2,20,0)
+  gtk_widget_set_mapped (GTK_WIDGET (wbox), TRUE);
+#else
   GTK_WIDGET_SET_FLAGS (wbox, GTK_MAPPED);
+#endif
 
   for (child = wbox->children; child; child = child->next)
 #if GTK_CHECK_VERSION(2,20,0)
@@ -851,7 +859,11 @@ gtk_wrap_box_unmap (GtkWidget *widget)
   GtkWrapBox *wbox = GTK_WRAP_BOX (widget);
   GtkWrapBoxChild *child;
 
+#if GTK_CHECK_VERSION(2,20,0)
+  gtk_widget_set_mapped (GTK_WIDGET (wbox), FALSE);
+#else
   GTK_WIDGET_UNSET_FLAGS (wbox, GTK_MAPPED);
+#endif
 
   for (child = wbox->children; child; child = child->next)
 #if GTK_CHECK_VERSION(2,20,0)
diff --git a/app/interface.c b/app/interface.c
index ac14bb0..dc51862 100644
--- a/app/interface.c
+++ b/app/interface.c
@@ -413,7 +413,11 @@ create_zoom_widget(DDisplay *ddisp) {
   gtk_widget_show(entry);
 
   button = gtk_button_new();
+#if GTK_CHECK_VERSION(2,18,0)
+  gtk_widget_set_can_focus (GTK_WIDGET (button), FALSE);
+#else
   GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS);
+#endif
   arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_OUT);
   gtk_container_add(GTK_CONTAINER(button), arrow);
   gtk_box_pack_start(GTK_BOX(combo), button, TRUE, TRUE, 0);
diff --git a/app/layer_dialog.c b/app/layer_dialog.c
index 34d006b..f88a552 100644
--- a/app/layer_dialog.c
+++ b/app/layer_dialog.c
@@ -1237,7 +1237,11 @@ layer_dialog_edit_layer (DiaLayerWidget *layer_widget, Diagram *dia, Layer *laye
   gtk_widget_show (hbox);
 
   button = gtk_button_new_from_stock (GTK_STOCK_OK);
+#if GTK_CHECK_VERSION(2,18,0)
+  gtk_widget_set_can_default (GTK_WIDGET (button), TRUE);
+#else
   GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+#endif
   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->dialog)->action_area), 
 		      button, TRUE, TRUE, 0);
   if (layer_widget)
@@ -1254,7 +1258,11 @@ layer_dialog_edit_layer (DiaLayerWidget *layer_widget, Diagram *dia, Layer *laye
   gtk_widget_show (button);
 
   button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
+#if GTK_CHECK_VERSION(2,18,0)
+  gtk_widget_set_can_default (GTK_WIDGET (button), TRUE);
+#else
   GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+#endif
   gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->dialog)->action_area), 
 		      button, TRUE, TRUE, 0);
   g_signal_connect (GTK_OBJECT (button), "clicked",
diff --git a/app/menus.c b/app/menus.c
index 8e8893f..e0e7504 100644
--- a/app/menus.c
+++ b/app/menus.c
@@ -808,6 +808,12 @@ _ui_manager_connect_proxy (GtkUIManager *manager,
 	  gtk_widget_set_tooltip_text (proxy, tooltip);
 	  g_free (tooltip);
 	}
+      else
+	{
+	  const gchar *name = gtk_action_get_name (action);
+
+	  g_print ("Action '%s' missing tooltip\n", name);
+	}
     }
 }
 
diff --git a/app/sheets_dialog.c b/app/sheets_dialog.c
index 29b433e..ab9d292 100644
--- a/app/sheets_dialog.c
+++ b/app/sheets_dialog.c
@@ -259,12 +259,20 @@ create_sheets_shapeselection_dialog (void)
   ok_button = GTK_FILE_SELECTION (sheets_shapeselection_dialog)->ok_button;
   gtk_object_set_data (GTK_OBJECT (sheets_shapeselection_dialog), "ok_button", ok_button);
   gtk_widget_show (ok_button);
+#if GTK_CHECK_VERSION(2,18,0)
+  gtk_widget_set_can_default (GTK_WIDGET (ok_button), TRUE);
+#else
   GTK_WIDGET_SET_FLAGS (ok_button, GTK_CAN_DEFAULT);
+#endif
 
   cancel_button1 = GTK_FILE_SELECTION (sheets_shapeselection_dialog)->cancel_button;
   gtk_object_set_data (GTK_OBJECT (sheets_shapeselection_dialog), "cancel_button1", cancel_button1);
   gtk_widget_show (cancel_button1);
+#if GTK_CHECK_VERSION(2,18,0)
+  gtk_widget_set_can_default (GTK_WIDGET (cancel_button1), TRUE);
+#else
   GTK_WIDGET_SET_FLAGS (cancel_button1, GTK_CAN_DEFAULT);
+#endif
 
   g_signal_connect (GTK_OBJECT (ok_button), "clicked",
                       G_CALLBACK (on_sheets_shapeselection_dialog_button_ok_clicked),
diff --git a/lib/diaarrowchooser.c b/lib/diaarrowchooser.c
index 411b525..e4978c4 100644
--- a/lib/diaarrowchooser.c
+++ b/lib/diaarrowchooser.c
@@ -116,7 +116,11 @@ dia_arrow_preview_class_init(DiaArrowPreviewClass *class)
 static void
 dia_arrow_preview_init(DiaArrowPreview *arrow)
 {
+#if GTK_CHECK_VERSION(2,18,0)
+  gtk_widget_set_has_window (GTK_WIDGET (arrow), FALSE);
+#else
   GTK_WIDGET_SET_FLAGS (arrow, GTK_NO_WINDOW);
+#endif
 
   GTK_WIDGET (arrow)->requisition.width = 40 + GTK_MISC (arrow)->xpad * 2;
   GTK_WIDGET (arrow)->requisition.height = 20 + GTK_MISC (arrow)->ypad * 2;
diff --git a/lib/dialinechooser.c b/lib/dialinechooser.c
index 9d152df..35735cb 100644
--- a/lib/dialinechooser.c
+++ b/lib/dialinechooser.c
@@ -76,7 +76,11 @@ dia_line_preview_class_init (DiaLinePreviewClass *class)
 static void
 dia_line_preview_init (DiaLinePreview *line)
 {
+#if GTK_CHECK_VERSION(2,18,0)
+  gtk_widget_set_has_window (GTK_WIDGET (line), FALSE);
+#else
   GTK_WIDGET_SET_FLAGS (line, GTK_NO_WINDOW);
+#endif
 
   GTK_WIDGET (line)->requisition.width = 30 + GTK_MISC (line)->xpad * 2;
   GTK_WIDGET (line)->requisition.height = 15 + GTK_MISC (line)->ypad * 2;
diff --git a/lib/widgets.c b/lib/widgets.c
index 2cf09f5..b1de17f 100644
--- a/lib/widgets.c
+++ b/lib/widgets.c
@@ -2190,8 +2190,16 @@ dia_toggle_button_new(GtkWidget *on_widget, GtkWidget *off_widget)
   /* Make border as small as possible */
   gtk_misc_set_padding(GTK_MISC(images->on), 0, 0);
   gtk_misc_set_padding(GTK_MISC(images->off), 0, 0);
+#if GTK_CHECK_VERSION(2,18,0)
+  gtk_widget_set_can_focus (GTK_WIDGET (button), FALSE);
+#else
   GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS);
+#endif
+#if GTK_CHECK_VERSION(2,18,0)
+  gtk_widget_set_can_default (GTK_WIDGET (button), FALSE);
+#else
   GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_DEFAULT);
+#endif
 
   rcstyle = gtk_rc_style_new ();  
   rcstyle->xthickness = rcstyle->ythickness = 0;       
diff --git a/objects/AADL/edit_port_declaration.c b/objects/AADL/edit_port_declaration.c
index 0019d5d..6d35bb3 100755
--- a/objects/AADL/edit_port_declaration.c
+++ b/objects/AADL/edit_port_declaration.c
@@ -155,7 +155,11 @@ ObjectChange *edit_port_declaration_callback (DiaObject *obj,
 
   button = gtk_button_new_from_stock (GTK_STOCK_OK);
   gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
+#if GTK_CHECK_VERSION(2,18,0)
+  gtk_widget_set_can_default (GTK_WIDGET (button), TRUE);
+#else
   GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+#endif
   gtk_widget_grab_default (button);
   gtk_widget_show (button);
   
diff --git a/plug-ins/postscript/paginate_psprint.c b/plug-ins/postscript/paginate_psprint.c
index 0dbf6e3..d48bddf 100644
--- a/plug-ins/postscript/paginate_psprint.c
+++ b/plug-ins/postscript/paginate_psprint.c
@@ -314,7 +314,11 @@ diagram_print_ps(DiagramData *dia, const gchar* original_filename)
   button = gtk_button_new_with_label(_("OK"));
   g_signal_connect(GTK_OBJECT(button), "clicked", 
 		   G_CALLBACK(ok_pressed), &cont);
+#if GTK_CHECK_VERSION(2,18,0)
+  gtk_widget_set_can_default (GTK_WIDGET (button), TRUE);
+#else
   GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+#endif
   gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0);
   gtk_widget_grab_default(button);
   gtk_widget_show(button);
@@ -322,7 +326,11 @@ diagram_print_ps(DiagramData *dia, const gchar* original_filename)
   button = gtk_button_new_with_label(_("Cancel"));
   g_signal_connect(GTK_OBJECT(button), "clicked", 
 		   G_CALLBACK(gtk_main_quit), NULL);
+#if GTK_CHECK_VERSION(2,18,0)
+  gtk_widget_set_can_default (GTK_WIDGET (button), TRUE);
+#else
   GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
+#endif
   gtk_box_pack_start(GTK_BOX(box), button, TRUE, TRUE, 0);
   gtk_widget_show(button);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]