[Xfce4-commits] <exo:versioning-from-0.3-to-1> Cleanup some unneeded Gtk or Glib version checks.

Nick Schermer nick at xfce.org
Fri Aug 14 23:00:02 CEST 2009


Updating branch refs/heads/versioning-from-0.3-to-1
         to c9b8d885c034022ae7cbaba91f17ffc15b5608ea (commit)
       from 6a9b850134897ea57830de53dce38d6abb510193 (commit)

commit c9b8d885c034022ae7cbaba91f17ffc15b5608ea
Author: Nick Schermer <nick at xfce.org>
Date:   Fri Aug 14 22:59:00 2009 +0200

    Cleanup some unneeded Gtk or Glib version checks.

 exo-helper/main.c                       |    5 +----
 exo/exo-cell-renderer-ellipsized-text.c |   19 -------------------
 exo/exo-config.h.in                     |   23 ++++-------------------
 exo/exo-tree-view.c                     |    6 ------
 4 files changed, 5 insertions(+), 48 deletions(-)

diff --git a/exo-helper/main.c b/exo-helper/main.c
index 6917545..1a3c992 100644
--- a/exo-helper/main.c
+++ b/exo-helper/main.c
@@ -203,11 +203,8 @@ main (int argc, char **argv)
   else
     {
       result = EXIT_FAILURE;
-#if GLIB_CHECK_VERSION(2, 14, 0)
+
       g_printerr ("%s", g_option_context_get_help (opt_ctx, FALSE, NULL));
-#else
-      g_printerr (_("Unknown helper arguments.\n"));
-#endif
     }
 
   g_option_context_free (opt_ctx);
diff --git a/exo/exo-cell-renderer-ellipsized-text.c b/exo/exo-cell-renderer-ellipsized-text.c
index b9abff5..5dee42f 100644
--- a/exo/exo-cell-renderer-ellipsized-text.c
+++ b/exo/exo-cell-renderer-ellipsized-text.c
@@ -239,11 +239,7 @@ exo_cell_renderer_ellipsized_text_render (GtkCellRenderer     *renderer,
   ExoCellRendererEllipsizedTextPrivate *priv = EXO_CELL_RENDERER_ELLIPSIZED_TEXT_GET_PRIVATE (renderer);
   GdkRectangle                          text_area;
   GtkStateType                          state;
-#if !GTK_CHECK_VERSION(2,8,0)
-  GdkPoint                              points[8];
-#else
   cairo_t                              *cr;
-#endif
   gint                                  focus_line_width;
   gint                                  focus_padding;
   gint                                  text_height;
@@ -307,7 +303,6 @@ exo_cell_renderer_ellipsized_text_render (GtkCellRenderer     *renderer,
               x1 = x0 + text_width;
               y1 = y0 + text_height;
 
-#if GTK_CHECK_VERSION(2,8,0)
               /* Cairo produces nicer results than using a polygon
                * and so we use it directly if possible.
                */
@@ -324,20 +319,6 @@ exo_cell_renderer_ellipsized_text_render (GtkCellRenderer     *renderer,
               gdk_cairo_set_source_color (cr, &widget->style->base[state]);
               cairo_fill (cr);
               cairo_destroy (cr);
-#else
-              /* calculate a (more or less rounded) polygon */
-              points[0].x = x0 + 2; points[0].y = y0;
-              points[1].x = x1 - 2; points[1].y = y0;
-              points[2].x = x1;     points[2].y = y0 + 2;
-              points[3].x = x1;     points[3].y = y1 - 2;
-              points[4].x = x1 - 2; points[4].y = y1;
-              points[5].x = x0 + 2; points[5].y = y1;
-              points[6].x = x0;     points[6].y = y1 - 2;
-              points[7].x = x0;     points[7].y = y0 + 2;
-
-              /* render the indicator */
-              gdk_draw_polygon (window, widget->style->base_gc[state], TRUE, points, G_N_ELEMENTS (points));
-#endif
             }
 
           /* draw the focus indicator */
diff --git a/exo/exo-config.h.in b/exo/exo-config.h.in
index e03e803..78c882e 100644
--- a/exo/exo-config.h.in
+++ b/exo/exo-config.h.in
@@ -69,25 +69,10 @@ const gchar *exo_check_version (guint required_major,
 #endif /* __GNUC__ */
 #endif /* !defined(G_GNUC_WARN_UNUSED_RESULT) */
 
-/* with GObject >= 2.7.0, copying name, nick and blurb can be avoided */
-#if GLIB_CHECK_VERSION(2,7,0)
-#define EXO_PARAM_READABLE  (G_PARAM_READABLE \
-                           | G_PARAM_STATIC_NAME \
-                           | G_PARAM_STATIC_NICK \
-                           | G_PARAM_STATIC_BLURB)
-#define EXO_PARAM_WRITABLE  (G_PARAM_WRITABLE \
-                           | G_PARAM_STATIC_NAME \
-                           | G_PARAM_STATIC_NICK \
-                           | G_PARAM_STATIC_BLURB)
-#define EXO_PARAM_READWRITE (G_PARAM_READWRITE \
-                           | G_PARAM_STATIC_NAME \
-                           | G_PARAM_STATIC_NICK \
-                           | G_PARAM_STATIC_BLURB)
-#else
-#define EXO_PARAM_READABLE  (G_PARAM_READABLE)
-#define EXO_PARAM_WRITABLE  (G_PARAM_WRITABLE)
-#define EXO_PARAM_READWRITE (G_PARAM_READWRITE)
-#endif
+/* shorter macros for the GParamSpecs with static strings */
+#define EXO_PARAM_READABLE  (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)
+#define EXO_PARAM_WRITABLE  (G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)
+#define EXO_PARAM_READWRITE (G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
 
 G_END_DECLS
 
diff --git a/exo/exo-tree-view.c b/exo/exo-tree-view.c
index 60cf781..45b3520 100644
--- a/exo/exo-tree-view.c
+++ b/exo/exo-tree-view.c
@@ -308,7 +308,6 @@ exo_tree_view_button_press_event (GtkWidget      *widget,
         selected_paths = gtk_tree_selection_get_selected_rows (selection, NULL);
     }
 
-#if GTK_CHECK_VERSION(2,9,0)
   /* Rubberbanding in GtkTreeView 2.9.0 and above is rather buggy, unfortunately, and
    * doesn't interact properly with GTKs own DnD mechanism. So we need to block all
    * dragging here when pressing the mouse button on a not yet selected row if
@@ -343,7 +342,6 @@ exo_tree_view_button_press_event (GtkWidget      *widget,
           tree_view->priv->button_release_enables_rubber_banding = TRUE;
         }
     }
-#endif
 
   /* call the parent's button press handler */
   result = (*GTK_WIDGET_CLASS (exo_tree_view_parent_class)->button_press_event) (widget, event);
@@ -433,7 +431,6 @@ exo_tree_view_button_release_event (GtkWidget      *widget,
         }
     }
 
-#if GTK_CHECK_VERSION(2,9,0)
   /* check if we need to re-enable drag and drop */
   if (G_LIKELY (tree_view->priv->button_release_unblocks_dnd))
     {
@@ -454,7 +451,6 @@ exo_tree_view_button_release_event (GtkWidget      *widget,
       gtk_tree_view_set_rubber_banding (GTK_TREE_VIEW (tree_view), TRUE);
       tree_view->priv->button_release_enables_rubber_banding = FALSE;
     }
-#endif
 
   /* call the parent's button release handler */
   return (*GTK_WIDGET_CLASS (exo_tree_view_parent_class)->button_release_event) (widget, event);
@@ -473,7 +469,6 @@ exo_tree_view_motion_notify_event (GtkWidget      *widget,
   /* check if the event occurred on the tree view internal window and we are in single-click mode */
   if (event->window == gtk_tree_view_get_bin_window (GTK_TREE_VIEW (tree_view)) && tree_view->priv->single_click)
     {
-#if GTK_CHECK_VERSION(2,9,0)
       /* check if we're doing a rubberband selection right now (which means DnD is blocked) */
       if (G_UNLIKELY (tree_view->priv->button_release_unblocks_dnd))
         {
@@ -484,7 +479,6 @@ exo_tree_view_motion_notify_event (GtkWidget      *widget,
           gdk_window_set_cursor (event->window, NULL);
         }
       else
-#endif
         {
           /* determine the path at the event coordinates */
           if (!gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (tree_view), event->x, event->y, &path, NULL, NULL, NULL))



More information about the Xfce4-commits mailing list