[seahorse-plugins] Fix building of panel applet with libpanelapplet-4.0



commit f04894d0080f84df9902637ac1a0a7e260272edf
Author: Stef Walter <stefw collabora co uk>
Date:   Thu Feb 10 23:39:41 2011 +0100

    Fix building of panel applet with libpanelapplet-4.0
    
    This enables building with GTK+3.0
    
    https://bugzilla.gnome.org/show_bug.cgi?id=641275

 configure.in                     |   38 ++++++++++++----------
 plugins/applet/Makefile.am       |    6 ++--
 plugins/applet/seahorse-applet.c |   64 +------------------------------------
 3 files changed, 26 insertions(+), 82 deletions(-)
---
diff --git a/configure.in b/configure.in
index d467da3..31d7bfe 100644
--- a/configure.in
+++ b/configure.in
@@ -44,12 +44,16 @@ AC_MSG_RESULT([$with_gtk])
 case "$with_gtk" in
 	2.0)
 		GTK_API_VERSION=2.0
-		GTK_REQUIRED=2.23.0
-	;;
+		GTK_REQUIRED=2.22.0
+		LIBPANEL_APPLET_PACKAGE=libpanelapplet-3.0
+		LIBPANEL_APPLET_REQUIRED=2.30.2
+		;;
 	3.0)
 		GTK_API_VERSION=3.0
 		GTK_REQUIRED=2.91.1
-	;;
+		LIBPANEL_APPLET_PACKAGE=libpanelapplet-4.0
+		LIBPANEL_APPLET_REQUIRED=2.91.6
+		;;
 esac
 
 AC_SUBST(GTK_API_VERSION)
@@ -449,8 +453,6 @@ dnl ***************
 dnl APPLET
 dnl ***************
 
-PANEL_APPLET_REQUIRED=2.31.2
-
 with_panel_applet="no"
 
 if test "$enable_dbus" != "yes"; then
@@ -468,18 +470,20 @@ else
         echo "disabling panel applet"
     else
         echo "checking for supported versions of libpanelapplet..."
-        
-        PKG_CHECK_MODULES(GNOME_APPLETS3, libpanelapplet-3.0 >= $PANEL_APPLET_REQUIRED,
-                [enable_applet=yes],
-                [enable_applet=no])
-
-        if test "$enable_applet" = "yes"; then
-            echo "enabling panel applet..."
-            AC_SUBST(GNOME_APPLETS3_CFLAGS)
-            AC_SUBST(GNOME_APPLETS3_LIBS)
-            AC_DEFINE(WITH_APPLET, 1, [Build the clipboard encryption panel applet])
-            with_panel_applet=yes
-        fi
+
+		PKG_CHECK_MODULES(LIBPANEL_APPLET, $LIBPANEL_APPLET_PACKAGE >= $LIBPANEL_APPLET_REQUIRED,
+							[enable_applet=yes],
+							[enable_applet=no])
+
+		if test "$enable_applet" = "yes"; then
+			echo "enabling panel applet..."
+			LIBPANEL_APPLET_API_VERSION=$($PKG_CONFIG --variable=libpanel_applet_api_version $LIBPANEL_APPLET_PACKAGE)
+			AC_SUBST(LIBPANEL_APPLET_API_VERSION)
+			AC_SUBST(LIBPANEL_APPLET_CFLAGS)
+			AC_SUBST(LIBPANEL_APPLET_LIBS)
+			AC_DEFINE(WITH_APPLET, 1, [Build the clipboard encryption panel applet])
+			with_panel_applet=yes
+		fi
     fi
 fi
 
diff --git a/plugins/applet/Makefile.am b/plugins/applet/Makefile.am
index 368b25c..eb52666 100644
--- a/plugins/applet/Makefile.am
+++ b/plugins/applet/Makefile.am
@@ -1,7 +1,7 @@
 SUBDIRS = docs
 DIST_SUBDIRS = docs
 
-appletdir	= $(datadir)/gnome-panel/applets
+appletdir	= $(datadir)/gnome-panel/$(LIBPANEL_APPLET_API_VERSION)/applets
 applet_in_files = org.gnome.applets.SeahorseApplet.panel-applet.in
 applet_DATA	= $(applet_in_files:.panel-applet.in=.panel-applet)
 
@@ -30,7 +30,7 @@ ui_DATA = \
 INCLUDES = \
 	-I.	\
 	-I$(srcdir) \
-	$(GNOME_APPLETS3_CFLAGS)	\
+	$(LIBPANEL_APPLET_CFLAGS)	\
 	-I$(includedir) \
 	-I$(top_srcdir)/libseahorse \
 	$(SEAHORSE_CFLAGS) \
@@ -49,7 +49,7 @@ seahorse_applet_SOURCES = \
 	seahorse-applet.h
 
 seahorse_applet_LDADD = \
-	$(GNOME_APPLETS3_LIBS) \
+	$(LIBPANEL_APPLET_LIBS) \
 	$(top_builddir)/libseahorse/libseahorse.a \
 	$(SEAHORSE_LIBS) \
 	$(LIBCRYPTUI_LIBS)
diff --git a/plugins/applet/seahorse-applet.c b/plugins/applet/seahorse-applet.c
index ab8ef03..055f3ef 100644
--- a/plugins/applet/seahorse-applet.c
+++ b/plugins/applet/seahorse-applet.c
@@ -261,30 +261,9 @@ handle_clipboard_owner_change(GtkClipboard *clipboard, GdkEvent *event,
         update_icon (sapplet);
 }
 
-/* Makes URL in About Dialog Clickable */
-static void about_dialog_activate_link_cb (GtkAboutDialog *about,
-                                           const gchar *url,
-                                           gpointer data)
-{
-        GtkWidget *dialog;
-	GError *error = NULL;
-	
-	if (!g_app_info_launch_default_for_uri (url, NULL, &error)) {
-		dialog = gtk_message_dialog_new (GTK_WINDOW (about), GTK_DIALOG_MODAL, 
-		                                 GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, 
-		                                 _("Could not display URL: %s"),
-		                                 error && error->message ? error->message : "");
-		g_signal_connect (G_OBJECT (dialog), "response",
-		                  G_CALLBACK (gtk_widget_destroy), NULL);
-		gtk_widget_show (dialog);
-	}
-}
-
 static void
 about_cb (GtkAction *action, SeahorseApplet *sapplet)
-{                   
-    static gboolean been_here = FALSE;
-    
+{
     static const gchar *authors [] = {
         "Adam Schreiber <sadam clemson edu>",
         "Stef Walter <stef memberwebs com>",
@@ -300,13 +279,7 @@ about_cb (GtkAction *action, SeahorseApplet *sapplet)
         "Stef Walter <stef memberwebs com>",
         NULL    
     };
-    
-	if (!been_here)
-	{
-		been_here = TRUE;
-		gtk_about_dialog_set_url_hook (about_dialog_activate_link_cb, NULL, NULL);
-	}
-	
+
     gtk_show_about_dialog (NULL, 
                 "name", _("seahorse-applet"),
                 "version", VERSION,
@@ -908,38 +881,6 @@ seahorse_applet_init (SeahorseApplet *applet)
 }
 
 static void
-seahorse_applet_change_background (PanelApplet *applet, PanelAppletBackgroundType type,
-                                   GdkColor *colour, GdkPixmap *pixmap)
-{
-    GtkRcStyle *rc_style;
-    GtkStyle *style;
-
-    /* reset style */
-    gtk_widget_set_style (GTK_WIDGET (applet), NULL);
-    rc_style = gtk_rc_style_new ();
-    gtk_widget_modify_style (GTK_WIDGET (applet), rc_style);
-    g_object_unref (rc_style);
-
-    switch (type){
-    case PANEL_NO_BACKGROUND:
-        break;
-    case PANEL_COLOR_BACKGROUND:
-        gtk_widget_modify_bg (GTK_WIDGET (applet), GTK_STATE_NORMAL, colour);
-        break;
-    case PANEL_PIXMAP_BACKGROUND:
-        style = gtk_style_copy (gtk_widget_get_style (GTK_WIDGET (applet)));
-
-        if (style->bg_pixmap[GTK_STATE_NORMAL])
-            g_object_unref (style->bg_pixmap[GTK_STATE_NORMAL]);
-
-        style->bg_pixmap[GTK_STATE_NORMAL] = g_object_ref (pixmap);
-        gtk_widget_set_style (GTK_WIDGET (applet), style);
-        g_object_unref (style);
-        break;
-    }
-}
-
-static void
 seahorse_applet_finalize (GObject *object)
 {
     SeahorseAppletPrivate *priv = SEAHORSE_APPLET_GET_PRIVATE (object);
@@ -978,7 +919,6 @@ seahorse_applet_class_init (SeahorseAppletClass *klass)
     widget_class = GTK_WIDGET_CLASS(klass);
 
     object_class->finalize = seahorse_applet_finalize;
-    applet_class->change_background = seahorse_applet_change_background;
     widget_class->button_press_event = handle_button_press;
 
     g_type_class_add_private (object_class, sizeof (SeahorseAppletPrivate));



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