[dia/dia-next: 22/59] Remove usage of GTK_CHECK_VERSION



commit c45b4f9368410bb80b12d2c8757264854adaaafd
Author: Zander Brown <zbrown gnome org>
Date:   Sun Dec 23 21:28:27 2018 +0000

    Remove usage of GTK_CHECK_VERSION
    
    There is no point branching based on different versions of Gtk2 when targeting Gtk3

 app/app_procs.c                        | 18 --------------
 app/commands.c                         |  5 ----
 app/confirm.c                          |  4 ----
 app/cursor.c                           |  4 ----
 app/diagram_tree_view.c                |  4 ----
 app/disp_callbacks.c                   |  8 -------
 app/display.c                          | 16 -------------
 app/filedlg.c                          | 32 -------------------------
 app/gtkhwrapbox.c                      | 25 -------------------
 app/gtkvwrapbox.c                      | 25 -------------------
 app/gtkwrapbox.c                       | 44 ----------------------------------
 app/interface.c                        | 32 -------------------------
 app/layer_dialog.c                     |  8 -------
 app/menus.c                            | 29 +---------------------
 app/preferences.c                      |  8 -------
 app/properties-dialog.c                |  4 ----
 app/ruler.c                            |  8 -------
 bindings/dia-extra.cpp                 |  3 ---
 lib/diaarrowchooser.c                  |  4 ----
 lib/dialinechooser.c                   |  4 ----
 lib/persistence.c                      | 12 ----------
 lib/prop_inttypes.c                    |  8 -------
 lib/renderer/diacairo-interactive.c    |  1 -
 lib/widgets.c                          |  8 -------
 objects/AADL/edit_port_declaration.c   |  4 ----
 plug-ins/pixbuf/pixbuf.c               | 18 --------------
 plug-ins/postscript/paginate_psprint.c |  8 -------
 plug-ins/python/diamodule.c            |  3 ---
 tests/test-objects.c                   |  3 ---
 29 files changed, 1 insertion(+), 349 deletions(-)
---
diff --git a/app/app_procs.c b/app/app_procs.c
index 739f0133..d22c0596 100644
--- a/app/app_procs.c
+++ b/app/app_procs.c
@@ -656,11 +656,6 @@ app_init (int argc, char **argv)
 
   argv0 = (argc > 0) ? argv[0] : "(none)";
 
-#if GTK_CHECK_VERSION(2,24,0)
-  /* ... use setlocale directly? */
-#else
-  gtk_set_locale();
-#endif
   setlocale(LC_NUMERIC, "C");
   _setup_textdomains ();
 
@@ -727,18 +722,9 @@ app_init (int argc, char **argv)
   }
 
   if (argv && dia_is_interactive) {
-#  if defined(G_THREADS_ENABLED) && !GLIB_CHECK_VERSION(2,32,0)
-    g_thread_init (NULL);
-#  endif
     gtk_init(&argc, &argv);
   }
   else {
-#if defined(G_THREADS_ENABLED) && !GLIB_CHECK_VERSION(2,32,0)
-    g_thread_init (NULL);
-#endif
-#if !GLIB_CHECK_VERSION(2,36,0)
-    g_type_init();
-#endif
     /*
      * On Windows there is no command line without display so that gtk_init is harmless. 
      * On X11 we need gtk_init_check() to avoid exit() just because there is no display 
@@ -997,11 +983,7 @@ 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/commands.c b/app/commands.c
index 81ee06d6..cb065e5b 100644
--- a/app/commands.c
+++ b/app/commands.c
@@ -1038,11 +1038,6 @@ help_about_callback (GtkAction *action)
   gchar *filename = g_build_filename (dirname, "dia-splash.png", NULL);
   GdkPixbuf *logo = gdk_pixbuf_new_from_file(filename, NULL);
 
-#if GTK_CHECK_VERSION(2,24,0)
-  /* rely on gtk_show_uri doing the right thing internally */
-#else
-  gtk_about_dialog_set_url_hook ((GtkAboutDialogActivateLinkFunc)activate_url, NULL, NULL);
-#endif
   gtk_show_about_dialog (NULL,
        "logo", logo,
         "name", "Dia",
diff --git a/app/confirm.c b/app/confirm.c
index 89b0803e..e342b75f 100644
--- a/app/confirm.c
+++ b/app/confirm.c
@@ -60,11 +60,7 @@ confirm_export_size (Diagram *dia, GtkWindow *parent, guint flags)
     return TRUE;
   
   /* message and limits depend on the flags give */
-#if GLIB_CHECK_VERSION(2,30,0)
   size = g_format_size (bytes);
-#else
-  size = g_format_size_for_display (bytes);
-#endif
   /* See: https://live.gnome.org/TranslationProject/DevGuidelines/Plurals */
   if (flags & CONFIRM_PRINT)
     msg = g_strdup_printf (g_dngettext (GETTEXT_PACKAGE,
diff --git a/app/cursor.c b/app/cursor.c
index 54f0549e..db266b6d 100644
--- a/app/cursor.c
+++ b/app/cursor.c
@@ -106,11 +106,7 @@ create_cursor(GdkWindow *window,
   GdkDisplay *display;
 
   g_return_val_if_fail(window != NULL, NULL);
-#if GTK_CHECK_VERSION (2,24,0)
   display = gdk_window_get_display (window);
-#else
-  display = gdk_drawable_get_display (GDK_DRAWABLE (window));
-#endif
 
   pixbuf = gdk_pixbuf_new_from_inline(-1, data, FALSE, NULL);
 
diff --git a/app/diagram_tree_view.c b/app/diagram_tree_view.c
index cd42a91a..810e3227 100644
--- a/app/diagram_tree_view.c
+++ b/app/diagram_tree_view.c
@@ -582,11 +582,7 @@ diagram_tree_show (void)
 
     gtk_window_set_role (GTK_WINDOW (window), "diagram_tree");
 
-#if GTK_CHECK_VERSION(2,20,0)
     if (!gtk_widget_get_visible (window))
-#else
-    if (!GTK_WIDGET_VISIBLE (window))
-#endif
       gtk_widget_show_all (window);
 
     /* FIXME: remove flicker by removing gtk_widget_show from persistence_register_window() */
diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c
index 68471039..a888a6fb 100644
--- a/app/disp_callbacks.c
+++ b/app/disp_callbacks.c
@@ -465,11 +465,7 @@ 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));
   
@@ -490,11 +486,7 @@ 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 b44700b0..1b26ca8a 100644
--- a/app/display.c
+++ b/app/display.c
@@ -1276,11 +1276,7 @@ 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",
@@ -1313,11 +1309,7 @@ display_update_menu_state(DDisplay *ddisp)
 
   gtk_toggle_action_set_active (rulers, display_get_rulers_showing(ddisp));
 
-#if GTK_CHECK_VERSION(2,20,0)
   scrollbars_shown = gtk_widget_get_visible (ddisp->hsb);
-#else
-  scrollbars_shown = GTK_WIDGET_VISIBLE (ddisp->hsb);
-#endif
   gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (menus_get_action ("ViewShowscrollbars")),
                                scrollbars_shown);
 
@@ -1474,11 +1466,7 @@ void display_rulers_show (DDisplay *ddisp)
     gtk_widget_show (ddisp->hrule);
     gtk_widget_show (ddisp->vrule);
 
-#if GTK_CHECK_VERSION(2,20,0)
     if (gtk_widget_get_visible (parent))
-#else
-    if (GTK_WIDGET_VISIBLE (parent))
-#endif
       gtk_widget_queue_resize (parent);
 
     ddisp->rulers_are_showing = TRUE;
@@ -1502,11 +1490,7 @@ void display_rulers_hide (DDisplay *ddisp)
     gtk_widget_hide (ddisp->hrule);
     gtk_widget_hide (ddisp->vrule);
     
-#if GTK_CHECK_VERSION(2,20,0)
     if (gtk_widget_get_visible (parent))
-#else
-    if (GTK_WIDGET_VISIBLE (parent))
-#endif
       gtk_widget_queue_resize (parent);
 
     ddisp->rulers_are_showing = FALSE;
diff --git a/app/filedlg.c b/app/filedlg.c
index e4219412..3a09ac88 100644
--- a/app/filedlg.c
+++ b/app/filedlg.c
@@ -188,16 +188,8 @@ create_open_menu(void)
   GList *tmp;
   
 
-#if GTK_CHECK_VERSION(2,24,0)
   menu = gtk_combo_box_text_new ();
-#else
-  menu = gtk_combo_box_new_text ();
-#endif
-#if GTK_CHECK_VERSION(2,24,0)
   gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(menu), _("By extension"));
-#else
-  gtk_combo_box_append_text(GTK_COMBO_BOX(menu), _("By extension"));
-#endif
   
   for (tmp = filter_get_import_filters(); tmp != NULL; tmp = tmp->next) {
     DiaImportFilter *ifilter = tmp->data;
@@ -206,11 +198,7 @@ create_open_menu(void)
     if (!ifilter)
       continue;
     filter_label = filter_get_import_filter_label(ifilter);
-#if GTK_CHECK_VERSION(2,24,0)
     gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(menu), filter_label);
-#else
-    gtk_combo_box_append_text (GTK_COMBO_BOX(menu), filter_label);
-#endif
     g_free(filter_label);
   }
   g_signal_connect(G_OBJECT(menu), "changed",
@@ -312,11 +300,7 @@ file_open_callback(GtkAction *action)
                     G_CALLBACK(gtk_widget_destroyed), &opendlg);
   } else {
     gtk_widget_set_sensitive(opendlg, TRUE);
-#if GTK_CHECK_VERSION(2,20,0)
     if (gtk_widget_get_visible(opendlg))
-#else
-    if (GTK_WIDGET_VISIBLE(opendlg))
-#endif
       return;
   }
   if (!gtk_file_chooser_get_extra_widget(GTK_FILE_CHOOSER(opendlg))) {
@@ -529,11 +513,7 @@ file_save_as_dialog_prepare (Diagram *dia, DDisplay *ddisp)
     g_signal_handlers_unblock_by_func(G_OBJECT(compressbutton), toggle_compress_callback, NULL);
     if (g_object_get_data (G_OBJECT (savedlg), "user_data") != NULL)
       g_object_unref (g_object_get_data (G_OBJECT (savedlg), "user_data"));
-#if GTK_CHECK_VERSION(2,20,0)
     if (gtk_widget_get_visible(savedlg)) {
-#else
-    if (GTK_WIDGET_VISIBLE(savedlg)) {
-#endif
       /* keep a refernce to the diagram */
       g_object_ref(dia);
       g_object_set_data (G_OBJECT (savedlg), "user_data", dia);
@@ -659,16 +639,8 @@ create_export_menu(void)
   GtkWidget *menu;
   GList *tmp;
 
-#if GTK_CHECK_VERSION(2,24,0)
   menu = gtk_combo_box_text_new ();
-#else
-  menu = gtk_combo_box_new_text ();
-#endif
-#if GTK_CHECK_VERSION(2,24,0)
   gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(menu), _("By extension"));
-#else
-  gtk_combo_box_append_text(GTK_COMBO_BOX(menu), _("By extension"));
-#endif
   
   for (tmp = filter_get_export_filters(); tmp != NULL; tmp = tmp->next) {
     DiaExportFilter *ef = tmp->data;
@@ -677,11 +649,7 @@ create_export_menu(void)
     if (!ef)
       continue;
     filter_label = filter_get_export_filter_label(ef);
-#if GTK_CHECK_VERSION(2,24,0)
     gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(menu), filter_label);
-#else
-    gtk_combo_box_append_text (GTK_COMBO_BOX(menu), filter_label);
-#endif
     g_free(filter_label);
   }
   g_signal_connect(G_OBJECT(menu), "changed",
diff --git a/app/gtkhwrapbox.c b/app/gtkhwrapbox.c
index b44f30da..ec796dfa 100644
--- a/app/gtkhwrapbox.c
+++ b/app/gtkhwrapbox.c
@@ -166,11 +166,7 @@ get_layout_size (GtkHWrapBox *this,
       GtkRequisition child_requisition;
       guint row_width, row_height, n = 1;
 
-#if GTK_CHECK_VERSION(2,20,0)
       if (!gtk_widget_get_visible (child->widget))
-#else
-      if (!GTK_WIDGET_VISIBLE (child->widget))
-#endif
         continue;
 
       get_child_requisition (wbox, child->widget, &child_requisition);
@@ -180,11 +176,7 @@ get_layout_size (GtkHWrapBox *this,
       row_height = child_requisition.height;
       for (row_child = child->next; row_child && n < wbox->child_limit; row_child = row_child->next)
         {
-#if GTK_CHECK_VERSION(2,20,0)
           if (gtk_widget_get_visible (row_child->widget))
-#else
-          if (GTK_WIDGET_VISIBLE (row_child->widget))
-#endif
             {
               get_child_requisition (wbox, row_child->widget, &child_requisition);
               if (row_width + wbox->hspacing + child_requisition.width > max_width)
@@ -291,11 +283,7 @@ reverse_list_row_children (GtkWrapBox       *wbox,
   *max_child_size = 0;
   *expand_line = FALSE;
 
-#if GTK_CHECK_VERSION(2,20,0)
   while (child && !gtk_widget_get_visible (child->widget))
-#else
-  while (child && !GTK_WIDGET_VISIBLE (child->widget))
-#endif
     {
       *child_p = child->next;
       child = *child_p;
@@ -316,11 +304,7 @@ reverse_list_row_children (GtkWrapBox       *wbox,
 
       while (child && n < wbox->child_limit)
         {
-#if GTK_CHECK_VERSION(2,20,0)
           if (gtk_widget_get_visible (child->widget))
-#else
-          if (GTK_WIDGET_VISIBLE (child->widget))
-#endif
             {
               get_child_requisition (wbox, child->widget, &child_requisition);
               if (width + wbox->hspacing + child_requisition.width > row_width ||
@@ -516,11 +500,7 @@ layout_rows (GtkWrapBox    *wbox,
   children_per_line = g_slist_length (slist);
   while (slist)
     {
-#if GLIB_CHECK_VERSION(2,10,0)
       Line *line = g_slice_new (Line);
-#else
-      Line *line = g_new (Line, 1);
-#endif
 
       line->children = slist;
       line->min_size = min_height;
@@ -627,15 +607,10 @@ layout_rows (GtkWrapBox    *wbox,
                       line->expand);
 
           g_slist_free (line->children);
-#if (!GLIB_CHECK_VERSION(2,10,0))
-                 g_free (line);
-#endif
           line = next_line;
         }
 
-#if GLIB_CHECK_VERSION(2,10,0)
       g_slice_free_chain (Line, line_list, next);
-#endif
     }
 }
 
diff --git a/app/gtkvwrapbox.c b/app/gtkvwrapbox.c
index fe51114c..4edf9196 100644
--- a/app/gtkvwrapbox.c
+++ b/app/gtkvwrapbox.c
@@ -165,11 +165,7 @@ get_layout_size (GtkVWrapBox *this,
       GtkRequisition child_requisition;
       guint col_height, col_width, n = 1;
 
-#if GTK_CHECK_VERSION(2,20,0)
       if (!gtk_widget_get_visible (child->widget))
-#else
-      if (!GTK_WIDGET_VISIBLE (child->widget))
-#endif
         continue;
 
       get_child_requisition (wbox, child->widget, &child_requisition);
@@ -179,11 +175,7 @@ get_layout_size (GtkVWrapBox *this,
       col_width = child_requisition.width;
       for (col_child = child->next; col_child && n < wbox->child_limit; col_child = col_child->next)
         {
-#if GTK_CHECK_VERSION(2,20,0)
           if (gtk_widget_get_visible (col_child->widget))
-#else
-          if (GTK_WIDGET_VISIBLE (col_child->widget))
-#endif
             {
               get_child_requisition (wbox, col_child->widget, &child_requisition);
               if (col_height + wbox->vspacing + child_requisition.height > max_height)
@@ -294,11 +286,7 @@ reverse_list_col_children (GtkWrapBox       *wbox,
   *max_child_size = 0;
   *expand_line = FALSE;
 
-#if GTK_CHECK_VERSION(2,20,0)
   while (child && !gtk_widget_get_visible (child->widget))
-#else
-  while (child && !GTK_WIDGET_VISIBLE (child->widget))
-#endif
     {
       *child_p = child->next;
       child = *child_p;
@@ -319,11 +307,7 @@ reverse_list_col_children (GtkWrapBox       *wbox,
 
       while (child && n < wbox->child_limit)
         {
-#if GTK_CHECK_VERSION(2,20,0)
           if (gtk_widget_get_visible (child->widget))
-#else
-          if (GTK_WIDGET_VISIBLE (child->widget))
-#endif
             {
               get_child_requisition (wbox, child->widget, &child_requisition);
               if (height + wbox->vspacing + child_requisition.height > col_height ||
@@ -519,11 +503,7 @@ layout_cols (GtkWrapBox    *wbox,
   children_per_line = g_slist_length (slist);
   while (slist)
     {
-#if GLIB_CHECK_VERSION(2,10,0)
       Line *line = g_slice_new (Line);
-#else
-      Line *line = g_new (Line, 1);
-#endif
 
       line->children = slist;
       line->min_size = min_width;
@@ -630,15 +610,10 @@ layout_cols (GtkWrapBox    *wbox,
                       line->expand);
 
           g_slist_free (line->children);
-#if (!GLIB_CHECK_VERSION(2,10,0))
-                 g_free (line);
-#endif
                  line = next_line;
         }
 
-#if GLIB_CHECK_VERSION(2,10,0)
       g_slice_free_chain (Line, line_list, next);
-#endif
     }
 }
 
diff --git a/app/gtkwrapbox.c b/app/gtkwrapbox.c
index 0614a5c8..f235c3f3 100644
--- a/app/gtkwrapbox.c
+++ b/app/gtkwrapbox.c
@@ -267,11 +267,7 @@ 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;
@@ -675,11 +671,7 @@ gtk_wrap_box_reorder_child (GtkWrapBox *wbox,
             wbox->children = child_info;
         }
 
-#if GTK_CHECK_VERSION(2,20,0)
       if (gtk_widget_get_visible (child) && gtk_widget_get_visible (GTK_WIDGET (wbox)))
-#else
-      if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (wbox))
-#endif
         gtk_widget_queue_resize (child);
     }
 }
@@ -752,11 +744,7 @@ gtk_wrap_box_set_child_packing (GtkWrapBox *wbox,
       child_info->vfill = vfill;
       child_info->wrapped = wrapped;
 
-#if GTK_CHECK_VERSION(2,20,0)
       if (gtk_widget_get_visible (child) && gtk_widget_get_visible (GTK_WIDGET (wbox)))
-#else
-      if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (wbox))
-#endif
         gtk_widget_queue_resize (child);
     }
 }
@@ -815,23 +803,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)
     if (gtk_widget_get_visible (child->widget) &&
-#else
-    if (GTK_WIDGET_VISIBLE (child->widget) &&
-#endif
-#if GTK_CHECK_VERSION(2,20,0)
         !gtk_widget_get_mapped (child->widget))
-#else
-        !GTK_WIDGET_MAPPED (child->widget))
-#endif
       gtk_widget_map (child->widget);
 }
 
@@ -841,23 +817,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)
     if (gtk_widget_get_visible (child->widget) &&
-#else
-    if (GTK_WIDGET_VISIBLE (child->widget) &&
-#endif
-#if GTK_CHECK_VERSION(2,20,0)
         gtk_widget_get_mapped (child->widget))
-#else
-        GTK_WIDGET_MAPPED (child->widget))
-#endif
       gtk_widget_unmap (child->widget);
 }
 
@@ -889,22 +853,14 @@ gtk_wrap_box_remove (GtkContainer *container,
         {
           gboolean was_visible;
 
-#if GTK_CHECK_VERSION(2,20,0)
           was_visible = gtk_widget_get_visible (widget);
-#else
-          was_visible = GTK_WIDGET_VISIBLE (widget);
-#endif
           gtk_widget_unparent (widget);
 
           if (last)
             last->next = child->next;
           else
             wbox->children = child->next;
-#if GLIB_CHECK_VERSION(2,10,0)
           g_slice_free (GtkWrapBoxChild, child);
-#else
-                 g_free (child);
-#endif
           wbox->n_children--;
 
           if (was_visible)
diff --git a/app/interface.c b/app/interface.c
index 0457d365..8632c47b 100644
--- a/app/interface.c
+++ b/app/interface.c
@@ -58,11 +58,7 @@ dia_dnd_file_drag_data_received (GtkWidget        *widget,
                                  guint             time,
                                 DDisplay         *ddisp)
 {
-#if GTK_CHECK_VERSION(2,22,0)
   switch (gdk_drag_context_get_selected_action(context))
-#else
-  switch (context->action)
-#endif
     {
     case GDK_ACTION_DEFAULT:
     case GDK_ACTION_COPY:
@@ -258,11 +254,7 @@ 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);
@@ -489,11 +481,7 @@ create_canvas (DDisplay *ddisp)
                    G_CALLBACK (canvas_configure_event), ddisp);
   g_signal_connect (G_OBJECT (canvas), "draw",
                     G_CALLBACK (canvas_draw), ddisp);
-#if GTK_CHECK_VERSION(2,18,0)
   gtk_widget_set_can_focus (canvas, TRUE);
-#else
-  GTK_WIDGET_SET_FLAGS (canvas, GTK_CAN_FOCUS);
-#endif
   g_signal_connect (G_OBJECT (canvas), "event",
                     G_CALLBACK(ddisplay_canvas_events),
                     ddisp);
@@ -547,17 +535,9 @@ _ddisplay_setup_scrollbars (DDisplay *ddisp, GtkWidget *table, int width, int he
   ddisp->vsbdata = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, height, 1, (height-1)/4, height-1));
 
   ddisp->hsb = gtk_hscrollbar_new (ddisp->hsbdata);
-#if GTK_CHECK_VERSION(2,18,0)
   gtk_widget_set_can_focus (ddisp->hsb, FALSE);
-#else
-  GTK_WIDGET_UNSET_FLAGS (ddisp->hsb, GTK_CAN_FOCUS);
-#endif
   ddisp->vsb = gtk_vscrollbar_new (ddisp->vsbdata);
-#if GTK_CHECK_VERSION(2,18,0)
   gtk_widget_set_can_focus (ddisp->vsb, FALSE);
-#else
-  GTK_WIDGET_UNSET_FLAGS (ddisp->vsb, GTK_CAN_FOCUS);
-#endif
 
   /*  set up the scrollbar observers  */
   g_signal_connect (G_OBJECT (ddisp->hsbdata), "value_changed",
@@ -792,11 +772,7 @@ create_display_shell(DDisplay *ddisp,
   /*  scrollbars, rulers, canvas, menu popup button  */
   if (!use_mbar) {
       ddisp->origin = gtk_button_new();
-#if GTK_CHECK_VERSION(2,18,0)
       gtk_widget_set_can_focus (ddisp->origin, FALSE);
-#else
-      GTK_WIDGET_UNSET_FLAGS(ddisp->origin, GTK_CAN_FOCUS);
-#endif
       widget = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
       gtk_container_add(GTK_CONTAINER(ddisp->origin), widget);
       gtk_widget_set_tooltip_text(widget, _("Diagram menu."));
@@ -1222,11 +1198,7 @@ integrated_ui_toolbar_is_showing (void)
 {
   if (ui.toolbar)
   {
-#if GTK_CHECK_VERSION(2,20,0)
     return gtk_widget_get_visible (GTK_WIDGET (ui.toolbar))? TRUE : FALSE;
-#else
-    return GTK_WIDGET_VISIBLE (ui.toolbar)? TRUE : FALSE;
-#endif
   }
   return FALSE;
 }
@@ -1255,11 +1227,7 @@ integrated_ui_layer_view_is_showing (void)
 {
   if (ui.layer_view)
   {
-#if GTK_CHECK_VERSION(2,20,0)
     return gtk_widget_get_visible (GTK_WIDGET (ui.layer_view))? TRUE : FALSE;
-#else
-    return GTK_WIDGET_VISIBLE (ui.layer_view)? TRUE : FALSE;
-#endif
   }
   return FALSE;
 }
diff --git a/app/layer_dialog.c b/app/layer_dialog.c
index 11172455..b2c374ec 100644
--- a/app/layer_dialog.c
+++ b/app/layer_dialog.c
@@ -1177,11 +1177,7 @@ 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_get_action_area (GTK_DIALOG (dialog->dialog))), 
                      button, TRUE, TRUE, 0);
   if (layer_widget)
@@ -1198,11 +1194,7 @@ 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_get_action_area (GTK_DIALOG (dialog->dialog))), 
                      button, TRUE, TRUE, 0);
   g_signal_connect (G_OBJECT (button), "clicked",
diff --git a/app/menus.c b/app/menus.c
index f0e243a9..59ee1d9e 100644
--- a/app/menus.c
+++ b/app/menus.c
@@ -500,11 +500,7 @@ integrated_ui_toolbar_zoom_combo_selection_changed (GtkComboBox *combo,
     {
         float zoom_percent;
         gchar * text;
-#if GTK_CHECK_VERSION(2,24,0)
-       text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT (combo));
-#else
-       text = gtk_combo_box_get_active_text (combo);
-#endif
+        text = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT (combo));
         if (sscanf (text, "%f", &zoom_percent) == 1)
         {
             view_zoom_set (zoom_percent * 10.0);
@@ -581,18 +577,13 @@ create_integrated_ui_toolbar (void)
   g_free (uifile);  
 
   /* Zoom Combo Box Entry */
-#if GTK_CHECK_VERSION(2,24,0)
   w = gtk_combo_box_text_new_with_entry ();
-#else
-  w = gtk_combo_box_entry_new_text ();
-#endif
 
   g_object_set_data (G_OBJECT (toolbar), 
                      DIA_INTEGRATED_TOOLBAR_ZOOM_COMBO,
                      w);
   integrated_ui_toolbar_add_custom_item (toolbar, w);
  
-#if GTK_CHECK_VERSION(2,24,0)
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w), ZOOM_FIT);
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w), _("800%"));
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w), _("400%"));
@@ -604,19 +595,6 @@ create_integrated_ui_toolbar (void)
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w), _("50%"));
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w), _("25%"));
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w), _("10%"));
-#else
-  gtk_combo_box_append_text (GTK_COMBO_BOX (w), ZOOM_FIT);
-  gtk_combo_box_append_text (GTK_COMBO_BOX (w), _("800%"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (w), _("400%"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (w), _("300%"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (w), _("200%"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (w), _("150%"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (w), _("100%"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (w), _("75%"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (w), _("50%"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (w), _("25%"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (w), _("10%"));
-#endif
 
   g_signal_connect (G_OBJECT (w), 
                     "changed",
@@ -1022,11 +1000,6 @@ menus_init(void)
 
   /* after creating all menu items */
   load_accels ();
-#if GTK_CHECK_VERSION(2,24,0)
-  g_print ("TODO: Check accels being saved ...");
-#else
-  gtk_quit_add(1, save_accels, NULL);
-#endif
 }
 
 void
diff --git a/app/preferences.c b/app/preferences.c
index bb195f09..3eca6e08 100644
--- a/app/preferences.c
+++ b/app/preferences.c
@@ -522,19 +522,11 @@ prefs_get_property_widget(DiaPrefData *data)
     break;
   case PREF_CHOICE: {
     GList *names;
-#if GTK_CHECK_VERSION(2,24,0)
     widget = gtk_combo_box_text_new ();
-#else
-    widget = gtk_combo_box_new_text ();
-#endif
     for (names = (data->choice_list_function)(data); 
          names != NULL;
         names = g_list_next(names)) {
-#if GTK_CHECK_VERSION(2,24,0)
       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (widget), (gchar *)names->data);
-#else
-      gtk_combo_box_append_text (GTK_COMBO_BOX (widget), (gchar *)names->data);
-#endif
     }
     break;
   }
diff --git a/app/properties-dialog.c b/app/properties-dialog.c
index 16e086b3..431c1b26 100644
--- a/app/properties-dialog.c
+++ b/app/properties-dialog.c
@@ -181,11 +181,7 @@ properties_respond(GtkWidget *widget,
 static void
 properties_give_focus(GtkWidget *widget, gpointer data)
 {
-#if GTK_CHECK_VERSION(2,20,0)
   if (gtk_widget_get_can_focus(widget)) {
-#else
-  if (GTK_WIDGET_CAN_FOCUS(widget)) {
-#endif
     gtk_widget_grab_focus(widget);
   } else {
     if (GTK_IS_CONTAINER(widget)) {
diff --git a/app/ruler.c b/app/ruler.c
index 44ed29ea..cc2485a2 100644
--- a/app/ruler.c
+++ b/app/ruler.c
@@ -183,11 +183,7 @@ dia_ruler_motion_notify (GtkWidget      *widget,
       y = MAX(y - width/2, 0);
       height = width;
     }
-#if GTK_CHECK_VERSION(2,18,0)
   if (gtk_widget_is_drawable (GTK_WIDGET (ruler)))
-#else
-  if (GTK_WIDGET_DRAWABLE (ruler))
-#endif
     {
 #if 0
       /* this is a bit too expensive - on a slow enough computer the indicators lags */
@@ -251,11 +247,7 @@ dia_ruler_set_range (GtkWidget *self,
   ruler->position = position;
   ruler->max_size = max_size;
 
-#  if GTK_CHECK_VERSION(2,18,0)
   if (gtk_widget_is_drawable (GTK_WIDGET (ruler)))
-#  else
-  if (GTK_WIDGET_DRAWABLE (ruler))
-#  endif
     {
       gtk_widget_queue_draw (GTK_WIDGET (ruler));
       /* XXX: draw arrow at mouse position */
diff --git a/bindings/dia-extra.cpp b/bindings/dia-extra.cpp
index f386824a..a8c349e2 100644
--- a/bindings/dia-extra.cpp
+++ b/bindings/dia-extra.cpp
@@ -47,9 +47,6 @@
  */
 void dia::register_plugins ()
 {
-#if !GLIB_CHECK_VERSION(2,36,0)
-    g_type_init();
-#endif    
     libdia_init (DIA_MESSAGE_STDERR);
 
     dia_register_plugins ();
diff --git a/lib/diaarrowchooser.c b/lib/diaarrowchooser.c
index b9530f8a..9ff93b4c 100644
--- a/lib/diaarrowchooser.c
+++ b/lib/diaarrowchooser.c
@@ -134,11 +134,7 @@ dia_arrow_preview_set(DiaArrowPreview *arrow, ArrowType atype, gboolean left)
   if (arrow->atype != atype || arrow->left != left) {
     arrow->atype = atype;
     arrow->left = left;
-#if GTK_CHECK_VERSION(2,18,0)
     if (gtk_widget_is_drawable(GTK_WIDGET(arrow)))
-#else
-    if (GTK_WIDGET_DRAWABLE(arrow))
-#endif
       gtk_widget_queue_draw(GTK_WIDGET(arrow));
   }
 }
diff --git a/lib/dialinechooser.c b/lib/dialinechooser.c
index 5a877a87..01f5b909 100644
--- a/lib/dialinechooser.c
+++ b/lib/dialinechooser.c
@@ -95,11 +95,7 @@ dia_line_preview_set(DiaLinePreview *line, LineStyle lstyle)
 {
   if (line->lstyle != lstyle) {
     line->lstyle = lstyle;
-#if GTK_CHECK_VERSION(2,18,0)
     if (gtk_widget_is_drawable(GTK_WIDGET(line)))
-#else
-    if (GTK_WIDGET_DRAWABLE(line))
-#endif
       gtk_widget_queue_draw(GTK_WIDGET(line));
   }
 }
diff --git a/lib/persistence.c b/lib/persistence.c
index eca06901..232ed4ee 100644
--- a/lib/persistence.c
+++ b/lib/persistence.c
@@ -606,11 +606,7 @@ persistence_window_event_handler(GtkWindow *window, GdkEvent *event, gpointer da
     /* silence gcc */
     break;
   }
-#if GTK_CHECK_VERSION(2,20,0)
   persistence_update_window(window, !gtk_widget_get_mapped(GTK_WIDGET(window)));
-#else
-  persistence_update_window(window, !(GTK_WIDGET_MAPPED(window)));
-#endif
   /* continue processing */
   return FALSE;
 }
@@ -624,11 +620,7 @@ persistence_window_event_handler(GtkWindow *window, GdkEvent *event, gpointer da
 static gboolean
 persistence_hide_show_window(GtkWindow *window, gpointer data)
 {
-#if GTK_CHECK_VERSION(2,20,0)
   persistence_update_window(window, !(gtk_widget_get_mapped(GTK_WIDGET(window))));
-#else
-  persistence_update_window(window, !GTK_WIDGET_MAPPED(window));
-#endif
   return FALSE;
 }
 
@@ -689,11 +681,7 @@ persistence_register_window(GtkWindow *window)
     gtk_window_get_position(window, &wininfo->x, &wininfo->y);
     gtk_window_get_size(window, &wininfo->width, &wininfo->height);
     /* Drawable means visible & mapped, what we usually think of as open. */
-#if GTK_CHECK_VERSION(2,18,0)
     wininfo->isopen = gtk_widget_is_drawable(GTK_WIDGET(window));
-#else
-    wininfo->isopen = GTK_WIDGET_DRAWABLE(GTK_WIDGET(window));
-#endif
     g_hash_table_insert(persistent_windows, (gchar *)name, wininfo);
   }
   if (wininfo->window != NULL && wininfo->window != window) {
diff --git a/lib/prop_inttypes.c b/lib/prop_inttypes.c
index 67f1ec75..1148a141 100644
--- a/lib/prop_inttypes.c
+++ b/lib/prop_inttypes.c
@@ -492,17 +492,9 @@ enumprop_get_widget(EnumProperty *prop, PropDialog *dialog)
     PropEnumData *enumdata = prop->common.descr->extra_data;
     guint i;
 
-#if GTK_CHECK_VERSION(2,24,0)
     ret = gtk_combo_box_text_new ();
-#else
-    ret = gtk_combo_box_new_text ();
-#endif
     for (i = 0; enumdata[i].name != NULL; i++)
-#if GTK_CHECK_VERSION(2,24,0)
       gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (ret), _(enumdata[i].name)); 
-#else
-      gtk_combo_box_append_text (GTK_COMBO_BOX (ret), _(enumdata[i].name)); 
-#endif
     prophandler_connect(&prop->common, G_OBJECT (ret), "changed");
   } else {
     ret = gtk_entry_new(); /* should use spin button/option menu */
diff --git a/lib/renderer/diacairo-interactive.c b/lib/renderer/diacairo-interactive.c
index 77e668c7..f49a6404 100644
--- a/lib/renderer/diacairo-interactive.c
+++ b/lib/renderer/diacairo-interactive.c
@@ -23,7 +23,6 @@
 #include "diacairo.h"
 
 #include <gdk/gdk.h>
-#include <gtk/gtk.h> /* GTK_CHECK_VERSION */
 
 #include "intl.h"
 #include "diatransform.h"
diff --git a/lib/widgets.c b/lib/widgets.c
index d1467630..fc137d84 100644
--- a/lib/widgets.c
+++ b/lib/widgets.c
@@ -745,16 +745,8 @@ 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 fcc9171e..a0c1873c 100755
--- a/objects/AADL/edit_port_declaration.c
+++ b/objects/AADL/edit_port_declaration.c
@@ -154,11 +154,7 @@ 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/pixbuf/pixbuf.c b/plug-ins/pixbuf/pixbuf.c
index e7c0b6a9..dcb7e8ab 100644
--- a/plug-ins/pixbuf/pixbuf.c
+++ b/plug-ins/pixbuf/pixbuf.c
@@ -74,26 +74,8 @@ export_data(DiagramData *data, DiaContext *ctx,
 
   data_render (data, DIA_RENDERER (renderer), NULL, NULL, NULL);
 
-  #if GTK_CHECK_VERSION(3,0,0)
   pixbuf = gdk_pixbuf_get_from_surface (renderer->surface, 0, 0,
                                         width, height);
-  #else
-  {
-    GdkPixmap *pixmap;
-    cairo_t *cr;
-
-    pixmap = gdk_pixmap_new (NULL, width, height, 24);
-    cr = gdk_cairo_create (pixmap);
-
-    cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
-    cairo_set_source_surface (cr, renderer->surface, 0, 0);
-    cairo_paint (cr);
-    pixbuf = gdk_pixbuf_get_from_drawable (NULL,
-                                           pixmap,
-                                           gdk_colormap_get_system (),
-                                           0, 0, 0, 0, width, height);
-  }
-  #endif
   if (pixbuf)
     {
       gdk_pixbuf_save (pixbuf, filename, format, &error, NULL);
diff --git a/plug-ins/postscript/paginate_psprint.c b/plug-ins/postscript/paginate_psprint.c
index f36db526..a2b44123 100644
--- a/plug-ins/postscript/paginate_psprint.c
+++ b/plug-ins/postscript/paginate_psprint.c
@@ -314,11 +314,7 @@ diagram_print_ps(DiagramData *dia, const gchar* original_filename)
   button = gtk_button_new_with_label(_("OK"));
   g_signal_connect(G_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);
@@ -326,11 +322,7 @@ diagram_print_ps(DiagramData *dia, const gchar* original_filename)
   button = gtk_button_new_with_label(_("Cancel"));
   g_signal_connect(G_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);
 
diff --git a/plug-ins/python/diamodule.c b/plug-ins/python/diamodule.c
index 01b774d6..6b424b9e 100644
--- a/plug-ins/python/diamodule.c
+++ b/plug-ins/python/diamodule.c
@@ -672,9 +672,6 @@ initdia(void)
        Py_FatalError("can't initialize module dia");
     else {
       /* should all be no-ops when used embedded */
-#if !GLIB_CHECK_VERSION(2,36,0)
-      g_type_init ();
-#endif
       libdia_init (DIA_MESSAGE_STDERR);
     }
 }
diff --git a/tests/test-objects.c b/tests/test-objects.c
index 6388786a..4a21b9d3 100644
--- a/tests/test-objects.c
+++ b/tests/test-objects.c
@@ -1069,9 +1069,6 @@ main (int argc, char** argv)
   SetErrorMode(SetErrorMode(0) | SEM_NOGPFAULTERRORBOX);
 #endif
 
-#if !GLIB_CHECK_VERSION(2,36,0)
-  g_type_init ();
-#endif
   /* not using gtk_test_init() means we can only test non-gtk facilities of objects */
   g_test_init (&argc, &argv, NULL);
   


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