[Xfce4-commits] [panel-plugins/xfce4-places-plugin] 22/30: Drop GTK_CHECK_VERSION checks, current minimum is 3.22

noreply at xfce.org noreply at xfce.org
Mon Apr 22 12:08:13 CEST 2019


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository panel-plugins/xfce4-places-plugin.

commit 2493cd63b3d5388e4bc6dcbd154148765bb73e8c
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Sun Apr 21 07:10:39 2019 -0400

    Drop GTK_CHECK_VERSION checks, current minimum is 3.22
---
 panel-plugin/cfg.c  | 15 ---------
 panel-plugin/cfg.h  |  2 --
 panel-plugin/view.c | 88 -----------------------------------------------------
 panel-plugin/view.h |  2 --
 4 files changed, 107 deletions(-)

diff --git a/panel-plugin/cfg.c b/panel-plugin/cfg.c
index e3effc8..70c4d65 100644
--- a/panel-plugin/cfg.c
+++ b/panel-plugin/cfg.c
@@ -56,11 +56,9 @@ enum
   PROP_SHOW_VOLUMES,
   PROP_MOUNT_OPEN_VOLUMES,
   PROP_SHOW_BOOKMARKS,
-#if USE_RECENT_DOCUMENTS
   PROP_SHOW_RECENT,
   PROP_SHOW_RECENT_CLEAR,
   PROP_SHOW_RECENT_NUMBER,
-#endif
   PROP_SEARCH_CMD
 };
 
@@ -126,7 +124,6 @@ places_cfg_class_init (PlacesCfgClass *klass)
                                                          TRUE,
                                                          EXO_PARAM_READWRITE));
 
-#if USE_RECENT_DOCUMENTS
   g_object_class_install_property (gobject_class,
                                    PROP_SHOW_RECENT,
                                    g_param_spec_boolean ("show-recent", NULL, NULL,
@@ -147,7 +144,6 @@ places_cfg_class_init (PlacesCfgClass *klass)
                                                       25,
                                                       10,
                                                       EXO_PARAM_READWRITE));
-#endif
 
   g_object_class_install_property (gobject_class,
                                    PROP_SEARCH_CMD,
@@ -192,11 +188,9 @@ places_cfg_init (PlacesCfg *cfg)
   cfg->show_volumes       = TRUE;
   cfg->mount_open_volumes = FALSE;
   cfg->show_bookmarks     = TRUE;
-#if USE_RECENT_DOCUMENTS
   cfg->show_recent        = TRUE;
   cfg->show_recent_clear  = TRUE;
   cfg->show_recent_number = 10;
-#endif
   cfg->search_cmd = g_strdup("");
   cfg->label = g_strdup(_("Places"));
 }
@@ -241,7 +235,6 @@ places_cfg_get_property (GObject    *object,
       g_value_set_boolean (value, cfg->show_bookmarks);
       break;
 
-#if USE_RECENT_DOCUMENTS
     case PROP_SHOW_RECENT:
       g_value_set_boolean (value, cfg->show_recent);
       break;
@@ -253,7 +246,6 @@ places_cfg_get_property (GObject    *object,
     case PROP_SHOW_RECENT_NUMBER:
       g_value_set_uint (value, cfg->show_recent_number);
       break;
-#endif
 
     case PROP_SEARCH_CMD:
       g_value_set_string (value, cfg->search_cmd);
@@ -341,7 +333,6 @@ places_cfg_set_property (GObject      *object,
         }
       break;
 
-#if USE_RECENT_DOCUMENTS
     case PROP_SHOW_RECENT:
       val = g_value_get_boolean (value);
       if (cfg->show_recent != val)
@@ -368,7 +359,6 @@ places_cfg_set_property (GObject      *object,
           g_signal_emit (G_OBJECT (cfg), places_cfg_signals[MENU_CHANGED], 0);
         }
       break;
-#endif
 
     case PROP_SEARCH_CMD:
       text = g_value_get_string (value);
@@ -423,9 +413,7 @@ places_cfg_open_dialog(PlacesCfg *cfg)
     GtkWidget *dlg;
     GtkWidget *frame_button, *vbox_button;
     GtkWidget *frame_menu,   *vbox_menu;
-#if USE_RECENT_DOCUMENTS
     GtkWidget *frame_recent, *vbox_recent;
-#endif
     GtkWidget *frame_search, *vbox_search;
 
     GtkWidget *tmp_box, *tmp_label, *tmp_widget;
@@ -534,8 +522,6 @@ places_cfg_open_dialog(PlacesCfg *cfg)
     gtk_widget_show(tmp_widget);
     gtk_box_pack_start(GTK_BOX(vbox_menu), tmp_widget, FALSE, FALSE, 0);
 
-
-#if USE_RECENT_DOCUMENTS
     /* MENU: Show Recent Documents */
     tmp_widget = gtk_check_button_new_with_mnemonic(_("Show recent _documents"));
     exo_mutual_binding_new (G_OBJECT (cfg), "show-recent",
@@ -582,7 +568,6 @@ places_cfg_open_dialog(PlacesCfg *cfg)
 
     gtk_widget_show(tmp_widget);
     gtk_box_pack_start(GTK_BOX(tmp_box), tmp_widget, FALSE, FALSE, 0);
-#endif
 
     /* Search: frame, vbox */
     vbox_search = gtk_box_new(GTK_ORIENTATION_VERTICAL, 4);
diff --git a/panel-plugin/cfg.h b/panel-plugin/cfg.h
index 54f1eef..ba278c8 100644
--- a/panel-plugin/cfg.h
+++ b/panel-plugin/cfg.h
@@ -53,11 +53,9 @@ struct _PlacesCfg
     gboolean            show_volumes;
     gboolean            mount_open_volumes;
     gboolean            show_bookmarks;
-#if USE_RECENT_DOCUMENTS
     gboolean            show_recent;
     gboolean            show_recent_clear;
     gint                show_recent_number;
-#endif
     gchar               *label;
     gchar               *search_cmd;
 
diff --git a/panel-plugin/view.c b/panel-plugin/view.c
index 82a5369..9f95ca0 100644
--- a/panel-plugin/view.c
+++ b/panel-plugin/view.c
@@ -47,8 +47,6 @@
 
 #include <gtk/gtk.h>
 
-#define USE_GTK_TOOLTIP_API     GTK_CHECK_VERSION(2,12,0)
-
 #include <libxfce4util/libxfce4util.h>
 #include <libxfce4panel/libxfce4panel.h>
 #include <libxfce4ui/libxfce4ui.h>
@@ -83,14 +81,7 @@ struct _PlacesView
     GtkWidget                 *button;
     GtkWidget                 *menu;
 
-#if !USE_GTK_TOOLTIP_API
-    GtkTooltips               *tooltips;
-#endif
-
-#if USE_RECENT_DOCUMENTS
     gulong                     recent_manager_changed_handler;
-#endif
-
     gboolean                   needs_separator;
     guint                      menu_timeout_id;
 
@@ -415,7 +406,6 @@ pview_cb_menu_item_activate(GtkWidget *menu_item, PlacesView *view)
 
 /* Recent Documents */
 
-#if USE_RECENT_DOCUMENTS
 static void
 pview_cb_recent_item_open(GtkRecentChooser *chooser, PlacesView *pd)
 {
@@ -471,8 +461,6 @@ pview_cb_recent_items_clear3(GtkWidget *clear_item, GdkEventButton *event, GtkWi
     return pview_cb_recent_items_clear(clear_item, recent_menu);
 }
 
-#endif
-
 
 /********** UI Helpers **********/
 
@@ -515,20 +503,16 @@ pview_get_icon(GIcon *icon)
 static void
 pview_destroy_menu(PlacesView *view)
 {
-#if USE_RECENT_DOCUMENTS
     GtkRecentManager *recent_manager = gtk_recent_manager_get_default();
-#endif
 
     if(view->menu != NULL) {
         gtk_menu_shell_deactivate(GTK_MENU_SHELL(view->menu));
 
-#if USE_RECENT_DOCUMENTS
         if (view->recent_manager_changed_handler) {
             g_signal_handler_disconnect(recent_manager,
                                         view->recent_manager_changed_handler);
             view->recent_manager_changed_handler = 0;
         }
-#endif
 
         gtk_widget_destroy(view->menu);
         view->menu = NULL;
@@ -611,13 +595,10 @@ pview_update_menu(PlacesView *pd)
     GList *bookmarks;
     PlacesBookmark *bookmark;
     GtkWidget *separator;
-
-#if USE_RECENT_DOCUMENTS
     GtkWidget *recent_menu;
     GtkWidget *clear_item;
     GtkWidget *recent_item;
     GtkRecentManager *recent_manager = gtk_recent_manager_get_default();
-#endif
 
     DBG("destroy menu");
 
@@ -662,11 +643,7 @@ pview_update_menu(PlacesView *pd)
     }
 
     /* "Search for Files" or "Recent Documents" -> separator */
-#if USE_RECENT_DOCUMENTS
     if(pd->cfg->show_recent || (pd->cfg->search_cmd != NULL && *pd->cfg->search_cmd != '\0')){
-#else
-    if(pd->cfg->search_cmd != NULL && *pd->cfg->search_cmd != '\0'){
-#endif
         separator = gtk_separator_menu_item_new();
         gtk_menu_shell_append(GTK_MENU_SHELL(pd->menu), separator);
         gtk_widget_show(separator);
@@ -695,7 +672,6 @@ pview_update_menu(PlacesView *pd)
     }
 
     /* Recent Documents */
-#if USE_RECENT_DOCUMENTS
     if(pd->cfg->show_recent){
 
         recent_menu = gtk_recent_chooser_menu_new();
@@ -751,7 +727,6 @@ pview_update_menu(PlacesView *pd)
                                                               G_CALLBACK(pview_cb_recent_changed), recent_menu);
         pview_cb_recent_changed(recent_manager, recent_menu);
     }
-#endif
 
     /* connect deactivate signal */
     g_signal_connect_swapped(pd->menu, "deactivate",
@@ -842,13 +817,7 @@ pview_button_update(PlacesView *view)
     /* tooltips */
     new_tooltip_text_hash = g_str_hash(cfg->label);
     if (new_tooltip_text_hash != tooltip_text_hash) {
-
-#if USE_GTK_TOOLTIP_API
         gtk_widget_set_tooltip_text(view->button, cfg->label);
-#else
-        gtk_tooltips_set_tip(view->tooltips, view->button, cfg->label, NULL);
-#endif
-
     }
     tooltip_text_hash = new_tooltip_text_hash;
 
@@ -859,53 +828,8 @@ pview_button_update(PlacesView *view)
 static gboolean
 pview_grab_available (void)
 {
-#if GTK_CHECK_VERSION(3, 0, 0)
     /* TODO fix for gtk3 */
     return TRUE;
-#else
-    GdkScreen *screen;
-    GdkWindow *root;
-    GdkGrabStatus grab_pointer = GDK_GRAB_FROZEN;
-    GdkGrabStatus grab_keyboard = GDK_GRAB_FROZEN;
-    gboolean grab_succeed = FALSE;
-    guint i;
-    GdkEventMask pointer_mask = GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_POINTER_MOTION_MASK;
-
-    screen = xfce_gdk_screen_get_active(NULL);
-    root = gdk_screen_get_root_window(screen);
-
-    /* don't try to get the grab for longer then 1/4 second */
-    for (i = 0; i < (G_USEC_PER_SEC / 100 / 4); i++)
-    {
-        grab_keyboard = gdk_keyboard_grab(root, TRUE, GDK_CURRENT_TIME);
-        if (grab_keyboard == GDK_GRAB_SUCCESS)
-        {
-            grab_pointer = gdk_pointer_grab(root, TRUE, pointer_mask,
-                                            NULL, NULL, GDK_CURRENT_TIME);
-            if (grab_pointer == GDK_GRAB_SUCCESS)
-            {
-                grab_succeed = TRUE;
-                break;
-            }
-        }
-
-        g_usleep(100);
-    }
-
-    /* release the grab so the gtk_menu_popup() can take it */
-    if (grab_pointer == GDK_GRAB_SUCCESS)
-        gdk_pointer_ungrab(GDK_CURRENT_TIME);
-    if (grab_keyboard == GDK_GRAB_SUCCESS)
-        gdk_keyboard_ungrab(GDK_CURRENT_TIME);
-
-    if (!grab_succeed)
-    {
-        g_printerr(PACKAGE_NAME ": Unable to get keyboard and mouse "
-                                "grab. Menu popup failed.\n");
-    }
-
-    return grab_succeed;
-#endif
 }
 
 
@@ -965,13 +889,6 @@ places_view_init(XfcePanelPlugin *plugin)
 
     pview_reconfigure_model(view);
 
-#if USE_GTK_TOOLTIP_API
-    DBG("using GtkTooltip API");
-#else
-    DBG("using GtkTooltips API");
-    view->tooltips = exo_gtk_object_ref_sink(GTK_OBJECT(gtk_tooltips_new()));
-#endif
-
     /* init button */
 
     DBG("init GUI");
@@ -1025,11 +942,6 @@ places_view_finalize(PlacesView *view)
         view->button = NULL;
     }
 
-#if !USE_GTK_TOOLTIP_API
-    g_object_unref(view->tooltips);
-    view->tooltips = NULL;
-#endif
-
     g_object_unref(view->cfg);
     view->cfg = NULL;
 
diff --git a/panel-plugin/view.h b/panel-plugin/view.h
index 50bc076..1d9b342 100644
--- a/panel-plugin/view.h
+++ b/panel-plugin/view.h
@@ -28,8 +28,6 @@
 #include <gtk/gtk.h>
 #include <libxfce4panel/libxfce4panel.h>
 
-#define USE_RECENT_DOCUMENTS    GTK_CHECK_VERSION(2,10,0)
-
 typedef struct _PlacesView PlacesView;
 
 /* Init & Finalize */

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list