[Xfce4-commits] [panel-plugins/xfce4-notes-plugin] 01/01: gtk3: Drop libunique and GTK+2 code from settings dialog

noreply at xfce.org noreply at xfce.org
Sun Oct 2 19:40:00 CEST 2016


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

mmassonnet pushed a commit to branch mmassonnet/gtk3-only
in repository panel-plugins/xfce4-notes-plugin.

commit 4381f90bc0ae71bfb620aefe6038a843cbd87052
Author: Mike Massonnet <m8t at gandi.net>
Date:   Sun Oct 2 19:38:50 2016 +0200

    gtk3: Drop libunique and GTK+2 code from settings dialog
    
    - Remove dependency on libunique
    - Bump requirement on xfce4-vala
    - Cleanup GTK+2 code from settings dialog
---
 configure.ac.in            |   8 +--
 src/Makefile.am            |  12 ++---
 src/main-settings-dialog.c | 121 +++------------------------------------------
 3 files changed, 13 insertions(+), 128 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index b9cb495..0b326a2 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -58,8 +58,7 @@ if test "x$USE_MAINTAINER_MODE" = "xyes" ; then
         if test "x$VALAC" = "x" ; then
                 AC_MSG_ERROR([Cannot find the "valac" compiler in your PATH])
         fi
-        # TODO look forward for an xfce4-vala 4.12 release
-        XDT_CHECK_PACKAGE([XFCE4VALA], [xfce4-vala], [4.10])
+        XDT_CHECK_PACKAGE([XFCE4VALA], [xfce4-vala], [4.12])
 fi
 
 dnl Translations
@@ -95,10 +94,7 @@ echo "* Maintainer Mode:        $USE_MAINTAINER_MODE"
 if test "x$USE_MAINTAINER_MODE" = "xyes" ; then
 echo
 echo "    * Vala:               $VALAC $am__vala_version"
-# TODO needed for panel plugin
-#if test "x$enable_gtk3" = "xno" ; then
-#echo "    * Xfce4-vala:         $XFCE4VALA_VERSION"
-#fi
+echo "    * Xfce4-vala:         $XFCE4VALA_VERSION"
 echo
 fi
 echo "* GTK+:                   $GTK_VERSION"
diff --git a/src/Makefile.am b/src/Makefile.am
index ab7278b..6544cd9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -45,16 +45,14 @@ xfce4_notes_settings_CFLAGS =						\
 	@LIBX11_CFLAGS@							\
 	@GTK_CFLAGS@							\
 	@LIBXFCE4UI_CFLAGS@						\
-	@XFCONF_CFLAGS@							\
-	@UNIQUE_CFLAGS@
+	@XFCONF_CFLAGS@
 
 xfce4_notes_settings_LDADD =						\
 	$(top_builddir)/lib/libnotes.la					\
 	@LIBX11_LIBS@							\
 	@GTK_LIBS@							\
 	@LIBXFCE4UI_LIBS@						\
-	@XFCONF_LIBS@							\
-	@UNIQUE_LIBS@
+	@XFCONF_LIBS@
 
 #
 # Panel plugin
@@ -147,16 +145,14 @@ xfce4_notes_CFLAGS =							\
 	@LIBX11_CFLAGS@							\
 	@GTK_CFLAGS@							\
 	@LIBXFCE4UTIL_CFLAGS@						\
-	@XFCONF_CFLAGS@							\
-	@UNIQUE_CFLAGS@
+	@XFCONF_CFLAGS@
 
 xfce4_notes_LDADD =							\
 	$(top_builddir)/lib/libnotes.la					\
 	@LIBX11_LIBS@							\
 	@GTK_LIBS@							\
 	@LIBXFCE4UTIL_LIBS@						\
-	@XFCONF_LIBS@							\
-	@UNIQUE_LIBS@
+	@XFCONF_LIBS@
 
 #
 # Plugin desktop file
diff --git a/src/main-settings-dialog.c b/src/main-settings-dialog.c
index ae8ed44..3778585 100644
--- a/src/main-settings-dialog.c
+++ b/src/main-settings-dialog.c
@@ -21,16 +21,13 @@
 #include <config.h>
 #endif
 
-#ifndef ENABLE_GTK3
-#include <unique/unique.h>
-#endif
 #include <xfconf/xfconf.h>
 #include <gtk/gtk.h>
 #include <libxfce4util/libxfce4util.h>
 #include <libxfce4ui/libxfce4ui.h>
 
 #include "defines.h"
-#include "ext-gdk.h"
+//#include "ext-gdk.h"
 
 #if 0
 static GtkWidget *notes_path_button_new ();
@@ -58,6 +55,7 @@ enum
 static GtkWidget *size_combo_box_new ();
 static void cb_size_combobox_changed (GtkComboBox *combobox, gpointer data);
 
+#if 0
 #ifndef ENABLE_GTK3
 enum
 {
@@ -85,13 +83,16 @@ static gboolean timeout_cb_background_changed (gchar *color);
 static GtkWidget *color_button_new ();
 static gboolean cb_color_button_pressed (GtkButton *button, GdkEventButton *event, gpointer data);
 #endif
+#endif
 
 static GtkWidget *parent_window = NULL;
 static XfconfChannel *xfconf_channel = NULL;
+#if 0
 #ifndef ENABLE_GTK3
 static GtkWidget *color_combobox = NULL;
 static GtkWidget *color_button = NULL;
 #endif
+#endif
 
 static GtkWidget *
 prop_dialog_new (void)
@@ -105,11 +106,7 @@ prop_dialog_new (void)
   /* Dialog */
   parent_window = dialog =
     xfce_titled_dialog_new_with_buttons (_("Notes"), NULL,
-#ifdef ENABLE_GTK3
                                          GTK_DIALOG_DESTROY_WITH_PARENT,
-#else
-                                         GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_NO_SEPARATOR,
-#endif
                                          GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
                                          NULL);
   xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (dialog), _("Configure the plugin"));
@@ -126,19 +123,11 @@ prop_dialog_new (void)
   gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), notebook);
 
   /* VBox */
-#ifdef ENABLE_GTK3
   vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
-  vbox = gtk_vbox_new (FALSE, 0);
-#endif
   gtk_container_add (GTK_CONTAINER (notebook), vbox);
 
   /* === Global settings === */
-#ifdef ENABLE_GTK3
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, BORDER);
-#else
-  box = gtk_vbox_new (FALSE, BORDER);
-#endif
   frame = xfce_gtk_frame_box_new_with_content (_("Global settings"), box);
   gtk_container_set_border_width (GTK_CONTAINER (frame), BORDER);
   gtk_container_add (GTK_CONTAINER (vbox), frame);
@@ -159,11 +148,7 @@ prop_dialog_new (void)
  * to select an empty directory otherwise things might really get
  * mixed up.
  */
-#ifdef ENABLE_GTK3
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BORDER);
-#else
-  hbox = gtk_hbox_new (FALSE, BORDER);
-#endif
   gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, FALSE, 0);
 
   label = gtk_label_new (_("Notes path:"));
@@ -174,11 +159,7 @@ prop_dialog_new (void)
 #endif
 
   /* Tabs position */
-#ifdef ENABLE_GTK3
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BORDER);
-#else
-  hbox = gtk_hbox_new (FALSE, BORDER);
-#endif
   gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, FALSE, 0);
 
   label = gtk_label_new (_("Tabs position:"));
@@ -187,13 +168,9 @@ prop_dialog_new (void)
   button = tabs_combo_box_new ();
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
 
-#ifndef ENABLE_GTK3
+#if 0
   /* Background color */
-#ifdef ENABLE_GTK3
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BORDER);
-#else
-  hbox = gtk_hbox_new (FALSE, BORDER);
-#endif
   gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, FALSE, 0);
 
   label = gtk_label_new (_("Background:"));
@@ -207,11 +184,7 @@ prop_dialog_new (void)
 #endif
 
   /* Font description */
-#ifdef ENABLE_GTK3
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BORDER);
-#else
-  hbox = gtk_hbox_new (FALSE, BORDER);
-#endif
   gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, FALSE, 0);
 
   label = gtk_label_new (_("Font:"));
@@ -223,11 +196,7 @@ prop_dialog_new (void)
   gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
 
   /* === New window settings === */
-#ifdef ENABLE_GTK3
   box = gtk_box_new (GTK_ORIENTATION_VERTICAL, BORDER);
-#else
-  box = gtk_vbox_new (FALSE, BORDER);
-#endif
   frame = xfce_gtk_frame_box_new_with_content (_("New group settings"), box);
   gtk_container_set_border_width (GTK_CONTAINER (frame), BORDER);
   gtk_container_add (GTK_CONTAINER (vbox), frame);
@@ -247,11 +216,7 @@ prop_dialog_new (void)
   gtk_box_pack_start (GTK_BOX (box), button, TRUE, FALSE, 0);
 
   /* Size */
-#ifdef ENABLE_GTK3
   hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, BORDER);
-#else
-  hbox = gtk_hbox_new (FALSE, BORDER);
-#endif
   gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, FALSE, 0);
 
   label = gtk_label_new (_("Size:"));
@@ -323,21 +288,12 @@ tabs_combo_box_new (void)
 {
   GtkWidget *combobox;
 
-#ifdef ENABLE_GTK3
   combobox = gtk_combo_box_text_new ();
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("None"));
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Top"));
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Right"));
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Bottom"));
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Left"));
-#else
-  combobox = gtk_combo_box_new_text ();
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("None"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Top"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Right"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Bottom"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Left"));
-#endif
   gtk_combo_box_set_active (GTK_COMBO_BOX (combobox), 0);
 
   xfconf_g_property_bind (xfconf_channel, "/global/tabs-position",
@@ -352,17 +308,10 @@ size_combo_box_new (void)
   GtkWidget *combobox;
   gint size;
 
-#ifdef ENABLE_GTK3
   combobox = gtk_combo_box_text_new ();
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Small"));
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Normal"));
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Large"));
-#else
-  combobox = gtk_combo_box_new_text ();
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Small"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Normal"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Large"));
-#endif
 
   size = xfconf_channel_get_int (xfconf_channel, "/new-window/width", SIZE_NORMAL);
   if (size == SIZE_SMALL)
@@ -412,7 +361,7 @@ cb_size_combobox_changed (GtkComboBox *combobox,
   xfconf_channel_set_int (xfconf_channel, "/new-window/height", height);
 }
 
-#ifndef ENABLE_GTK3
+#if 0
 static GtkWidget *
 background_combo_box_new (void)
 {
@@ -420,7 +369,6 @@ background_combo_box_new (void)
   gchar *color;
   gint id;
 
-#ifdef ENABLE_GTK3
   combobox = gtk_combo_box_text_new ();
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Yellow"));
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Blue"));
@@ -433,20 +381,6 @@ background_combo_box_new (void)
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Android"));
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("GTK+"));
   gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox), _("Custom..."));
-#else
-  combobox = gtk_combo_box_new_text ();
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Yellow"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Blue"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Green"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Indigo"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Olive"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Carmine"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Mimosa"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("White"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Android"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("GTK+"));
-  gtk_combo_box_append_text (GTK_COMBO_BOX (combobox), _("Custom..."));
-#endif
 
   color = xfconf_channel_get_string (xfconf_channel, "/global/background-color", GENERAL_BACKGROUND_COLOR);
   if (!g_ascii_strcasecmp (color, BACKGROUND_YELLOW))
@@ -634,9 +568,6 @@ color_button_new (void)
   g_free (color);
 
   button = gtk_color_button_new_with_color (&gdkcolor);
-#ifndef ENABLE_GTK3
-  gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
-#endif
 
   g_signal_connect (button, "button-press-event", G_CALLBACK (cb_color_button_pressed), NULL);
 
@@ -666,38 +597,15 @@ cb_color_button_pressed (GtkButton *button,
 
 
 
-#ifndef ENABLE_GTK3
-static UniqueResponse
-cb_unique_app (UniqueApp *app,
-               gint command,
-               UniqueMessageData *message_data,
-               guint time_,
-               gpointer user_data)
-{
-  GtkWidget *dialog = user_data;
-  if (command != UNIQUE_ACTIVATE)
-    {
-      return UNIQUE_RESPONSE_PASSTHROUGH;
-    }
-  gtk_window_present (GTK_WINDOW (dialog));
-  return UNIQUE_RESPONSE_OK;
-}
-#endif
-
 gint main (gint argc,
            gchar *argv[])
 {
   GtkWidget *dialog;
-#ifdef ENABLE_GTK3
   GtkApplication *app;
   GError *error = NULL;
-#else
-  UniqueApp *app;
-#endif
   xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, NULL);
   xfconf_init (NULL);
   gtk_init (&argc, &argv);
-#ifdef ENABLE_GTK3
   app = gtk_application_new ("org.xfce.NotesSettings", 0);
 
   g_application_register (G_APPLICATION (app), NULL, &error);
@@ -714,25 +622,10 @@ gint main (gint argc,
       g_object_unref (app);
       return 0;
     }
-#else
-  app = unique_app_new ("org.xfce.NotesSettings", NULL);
-  if (unique_app_is_running (app))
-    {
-      if (unique_app_send_message (app, UNIQUE_ACTIVATE, NULL) == UNIQUE_RESPONSE_OK)
-        {
-          g_object_unref (app);
-          return 0;
-        }
-    }
-#endif
 
   dialog = prop_dialog_new ();
 
-#ifdef ENABLE_GTK3
   g_signal_connect_swapped (app, "activate", G_CALLBACK (gtk_window_present), dialog);
-#else
-  g_signal_connect (app, "message-received", G_CALLBACK (cb_unique_app), dialog);
-#endif
 
   gtk_dialog_run (GTK_DIALOG (dialog));
   gtk_widget_destroy (dialog);

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


More information about the Xfce4-commits mailing list