[Xfce4-commits] [apps/mousepad] 01/05: Remove a bunch of #if checks for pre GTK+ 2.12

noreply at xfce.org noreply at xfce.org
Tue Jul 15 02:23:12 CEST 2014


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

mbrush pushed a commit to branch master
in repository apps/mousepad.

commit 7c6b178e9799986c609fe181d3a9dd70007945a1
Author: Matthew Brush <mbrush at codebrainz.ca>
Date:   Mon Jul 14 14:58:37 2014 -0700

    Remove a bunch of #if checks for pre GTK+ 2.12
---
 mousepad/mousepad-dialogs.c   |    4 ----
 mousepad/mousepad-document.c  |    6 +++---
 mousepad/mousepad-private.h   |    7 -------
 mousepad/mousepad-statusbar.c |    4 ++--
 mousepad/mousepad-util.c      |   20 --------------------
 mousepad/mousepad-util.h      |    5 -----
 mousepad/mousepad-window.c    |   30 ------------------------------
 7 files changed, 5 insertions(+), 71 deletions(-)

diff --git a/mousepad/mousepad-dialogs.c b/mousepad/mousepad-dialogs.c
index f1ab29d..115218f 100644
--- a/mousepad/mousepad-dialogs.c
+++ b/mousepad/mousepad-dialogs.c
@@ -41,11 +41,7 @@ mousepad_dialogs_show_about (GtkWindow *parent)
                          "comments", _("Mousepad is a fast text editor for the Xfce Desktop Environment."),
                          "destroy-with-parent", TRUE,
                          "logo-icon-name", "accessories-text-editor",
-#if GTK_CHECK_VERSION (2,12,0)
                          "program-name", PACKAGE_NAME,
-#else
-                         "name", PACKAGE_NAME,
-#endif
                          "version", PACKAGE_VERSION,
                          "translator-credits", _("translator-credits"),
                          "website", "http://www.xfce.org/",
diff --git a/mousepad/mousepad-document.c b/mousepad/mousepad-document.c
index 19d6886..b8abac4 100644
--- a/mousepad/mousepad-document.c
+++ b/mousepad/mousepad-document.c
@@ -391,7 +391,7 @@ mousepad_document_filename_changed (MousepadDocument *document,
           gtk_label_set_text (GTK_LABEL (document->priv->label), utf8_basename);
 
           /* set the tab tooltip */
-          mousepad_widget_set_tooltip_text (document->priv->ebox, utf8_filename);
+          gtk_widget_set_tooltip_text (document->priv->ebox, utf8_filename);
 
           /* update label color */
           mousepad_document_label_color (document);
@@ -486,7 +486,7 @@ mousepad_document_get_tab_label (MousepadDocument *document)
   /* the ebox */
   document->priv->ebox = g_object_new (GTK_TYPE_EVENT_BOX, "border-width", 2, "visible-window", FALSE, NULL);
   gtk_box_pack_start (GTK_BOX (hbox), document->priv->ebox, TRUE, TRUE, 0);
-  mousepad_widget_set_tooltip_text (document->priv->ebox, document->priv->utf8_filename);
+  gtk_widget_set_tooltip_text (document->priv->ebox, document->priv->utf8_filename);
   gtk_widget_show (document->priv->ebox);
 
   /* create the label */
@@ -511,7 +511,7 @@ mousepad_document_get_tab_label (MousepadDocument *document)
   g_object_unref (G_OBJECT (style));
 
   /* pack button, add signal and tooltip */
-  mousepad_widget_set_tooltip_text (button, _("Close this tab"));
+  gtk_widget_set_tooltip_text (button, _("Close this tab"));
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
   g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (mousepad_document_tab_button_clicked), document);
   gtk_widget_show (button);
diff --git a/mousepad/mousepad-private.h b/mousepad/mousepad-private.h
index 422e916..a3e9b7a 100644
--- a/mousepad/mousepad-private.h
+++ b/mousepad/mousepad-private.h
@@ -115,13 +115,6 @@ enum
 #define G_UNLIKELY(expr) (expr)
 #endif
 
-/* tooltip api */
-#if GTK_CHECK_VERSION (2,12,0)
-#define mousepad_widget_set_tooltip_text(widget,text) (gtk_widget_set_tooltip_text (widget, text))
-#else
-#define mousepad_widget_set_tooltip_text(widget,text) (mousepad_util_set_tooltip (widget, text))
-#endif
-
 /* GLib does some questionable (ie. non-standard) stuff when passing function
  * pointers as void pointers and such. This dirty little hack will at least
  * squelch warnings about it so we can easily see warnings that we can
diff --git a/mousepad/mousepad-statusbar.c b/mousepad/mousepad-statusbar.c
index a1cdcf2..6fb6f18 100644
--- a/mousepad/mousepad-statusbar.c
+++ b/mousepad/mousepad-statusbar.c
@@ -138,7 +138,7 @@ mousepad_statusbar_init (MousepadStatusbar *statusbar)
   ebox = gtk_event_box_new ();
   gtk_box_pack_start (GTK_BOX (box), ebox, FALSE, TRUE, 0);
   gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE);
-  mousepad_widget_set_tooltip_text (ebox, _("Choose a filetype"));
+  gtk_widget_set_tooltip_text (ebox, _("Choose a filetype"));
   g_signal_connect (G_OBJECT (ebox), "button-press-event", G_CALLBACK (mousepad_statusbar_filetype_clicked), statusbar);
   gtk_widget_show (ebox);
 
@@ -166,7 +166,7 @@ mousepad_statusbar_init (MousepadStatusbar *statusbar)
   ebox = gtk_event_box_new ();
   gtk_box_pack_start (GTK_BOX (box), ebox, FALSE, TRUE, 0);
   gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE);
-  mousepad_widget_set_tooltip_text (ebox, _("Toggle the overwrite mode"));
+  gtk_widget_set_tooltip_text (ebox, _("Toggle the overwrite mode"));
   g_signal_connect (G_OBJECT (ebox), "button-press-event", G_CALLBACK (mousepad_statusbar_overwrite_clicked), statusbar);
   gtk_widget_show (ebox);
 
diff --git a/mousepad/mousepad-util.c b/mousepad/mousepad-util.c
index 42d028c..d4a3961 100644
--- a/mousepad/mousepad-util.c
+++ b/mousepad/mousepad-util.c
@@ -472,26 +472,6 @@ mousepad_util_dialog_header (GtkDialog   *dialog,
 }
 
 
-#if !GTK_CHECK_VERSION (2,12,0)
-void
-mousepad_util_set_tooltip (GtkWidget   *widget,
-                           const gchar *string)
-{
-  static GtkTooltips *tooltips = NULL;
-
-  mousepad_return_if_fail (GTK_IS_WIDGET (widget));
-  mousepad_return_if_fail (string ? g_utf8_validate (string, -1, NULL) : TRUE);
-
-  /* allocate the shared tooltips on-demand */
-  if (G_UNLIKELY (tooltips == NULL))
-    tooltips = gtk_tooltips_new ();
-
-  /* setup the tooltip for the widget */
-  gtk_tooltips_set_tip (tooltips, widget, string, NULL);
-}
-#endif
-
-
 gint
 mousepad_util_get_real_line_offset (const GtkTextIter *iter,
                                     gint               tab_size)
diff --git a/mousepad/mousepad-util.h b/mousepad/mousepad-util.h
index 60334f8..6a064e2 100644
--- a/mousepad/mousepad-util.h
+++ b/mousepad/mousepad-util.h
@@ -89,11 +89,6 @@ void       mousepad_util_dialog_header                    (GtkDialog           *
                                                            const gchar         *subtitle,
                                                            const gchar         *icon);
 
-#if !GTK_CHECK_VERSION (2,12,0)
-void       mousepad_util_set_tooltip                      (GtkWidget           *widget,
-                                                           const gchar         *string);
-#endif
-
 gint       mousepad_util_get_real_line_offset             (const GtkTextIter   *iter,
                                                            gint                 tab_size);
 
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 47b8e62..a1612b6 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -53,9 +53,7 @@
 #define PADDING                   (2)
 #define PASTE_HISTORY_MENU_LENGTH (30)
 
-#if GTK_CHECK_VERSION (2,12,0)
 static gconstpointer NOTEBOOK_GROUP = "Mousepad";
-#endif
 
 
 
@@ -139,13 +137,11 @@ static gboolean          mousepad_window_notebook_button_release_event (GtkNoteb
 static gboolean          mousepad_window_notebook_button_press_event  (GtkNotebook            *notebook,
                                                                        GdkEventButton         *event,
                                                                        MousepadWindow         *window);
-#if GTK_CHECK_VERSION (2,12,0)
 static GtkNotebook      *mousepad_window_notebook_create_window       (GtkNotebook            *notebook,
                                                                        GtkWidget              *page,
                                                                        gint                    x,
                                                                        gint                    y,
                                                                        MousepadWindow         *window);
-#endif
 
 /* document signals */
 static void              mousepad_window_modified_changed             (MousepadWindow         *window);
@@ -915,11 +911,7 @@ mousepad_window_create_notebook (MousepadWindow *window)
                                    NULL);
 
   /* set the group id */
-#if GTK_CHECK_VERSION (2,12,0)
   gtk_notebook_set_group (GTK_NOTEBOOK (window->notebook), (gpointer) NOTEBOOK_GROUP);
-#else
-  gtk_notebook_set_group_id (GTK_NOTEBOOK (window->notebook), 1337);
-#endif
 
   /* connect signals to the notebooks */
   g_signal_connect (G_OBJECT (window->notebook), "switch-page", G_CALLBACK (mousepad_window_notebook_switch_page), window);
@@ -928,9 +920,7 @@ mousepad_window_create_notebook (MousepadWindow *window)
   g_signal_connect (G_OBJECT (window->notebook), "page-removed", G_CALLBACK (mousepad_window_notebook_removed), window);
   g_signal_connect (G_OBJECT (window->notebook), "button-press-event", G_CALLBACK (mousepad_window_notebook_button_press_event), window);
   g_signal_connect (G_OBJECT (window->notebook), "button-release-event", G_CALLBACK (mousepad_window_notebook_button_release_event), window);
-#if GTK_CHECK_VERSION (2,12,0)
   g_signal_connect (G_OBJECT (window->notebook), "create-window", G_CALLBACK (mousepad_window_notebook_create_window), window);
-#endif
 
   /* append and show the notebook */
   gtk_box_pack_start (GTK_BOX (window->box), window->notebook, TRUE, TRUE, PADDING);
@@ -2027,7 +2017,6 @@ mousepad_window_notebook_button_release_event (GtkNotebook    *notebook,
 
 
 
-#if GTK_CHECK_VERSION (2,12,0)
 static GtkNotebook *
 mousepad_window_notebook_create_window (GtkNotebook    *notebook,
                                         GtkWidget      *page,
@@ -2061,7 +2050,6 @@ mousepad_window_notebook_create_window (GtkNotebook    *notebook,
 
   return NULL;
 }
-#endif
 
 
 
@@ -4171,28 +4159,10 @@ mousepad_window_action_detach (GtkAction      *action,
   mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
   mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
 
-#if GTK_CHECK_VERSION (2,12,0)
   /* invoke function without cooridinates */
   mousepad_window_notebook_create_window (GTK_NOTEBOOK (window->notebook),
                                           GTK_WIDGET (window->active),
                                           -1, -1, window);
-#else
-  /* only detach when there are more then 2 tabs */
-  if (G_LIKELY (gtk_notebook_get_n_pages (GTK_NOTEBOOK (window->notebook)) >= 2))
-    {
-      /* take a reference */
-      g_object_ref (G_OBJECT (window->active));
-
-      /* remove the document from the active window */
-      gtk_container_remove (GTK_CONTAINER (window->notebook), GTK_WIDGET (window->active));
-
-      /* emit the new window with document signal */
-      g_signal_emit (G_OBJECT (window), window_signals[NEW_WINDOW_WITH_DOCUMENT], 0, window->active, -1, -1);
-
-      /* release our reference */
-      g_object_unref (G_OBJECT (window->active));
-    }
-#endif
 }
 
 

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


More information about the Xfce4-commits mailing list