[gnome-media] Drop libgnomeui dependency from media profiles



commit bc84f3f0d9c9cf071ec60aa16f0004266cb4b57c
Author: Jonathan Matthew <jonathan d14n org>
Date:   Thu Apr 23 20:37:38 2009 +1000

    Drop libgnomeui dependency from media profiles
    
    Use gtk_show_uri instead of gnome_help_display, and replace
    GnomeProgram's command line parsing with a GOptionContext.
---
 configure.ac                               |    3 +-
 profiles/audio-profile-edit.c              |    9 +++----
 profiles/audio-profiles-edit.c             |   10 +++-----
 profiles/gnome-audio-profiles-properties.c |   29 +++++++++++++++------------
 profiles/gnome-audio-profiles-test.c       |   23 ++++++++++++++-------
 profiles/gnome-media-profiles.pc.in        |    2 +-
 6 files changed, 41 insertions(+), 35 deletions(-)

diff --git a/configure.ac b/configure.ac
index b8a501f..c608e9c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,7 +60,7 @@ dnl Start of pkg-config checks - common libs
 dnl=======================================================================
 
 GLIB_REQUIRED_VERSION=2.18.2
-GTK_REQUIRED_VERSION=2.10.0
+GTK_REQUIRED_VERSION=2.14.0
 LIBGLADE_REQUIRED_VERSION=1.99.2
 GCONF_REQUIRED_VERSION=2.6.1
 PA_REQUIRED_VERSION=0.9.12 # FIXME remove extra checks below when we have PA 0.9.15
@@ -246,7 +246,6 @@ if test "x$enable_profiles" = "xyes"; then
     gstreamer-0.10
     gconf-2.0
     libglade-2.0
-    libgnomeui-2.0
     gio-2.0],
     have_profiles=yes)
 fi
diff --git a/profiles/audio-profile-edit.c b/profiles/audio-profile-edit.c
index ac25eee..bbdddf5 100644
--- a/profiles/audio-profile-edit.c
+++ b/profiles/audio-profile-edit.c
@@ -27,7 +27,6 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 #include <glade/glade-xml.h>
-#include <libgnomeui/gnome-help.h>
 #include <gst/gst.h>
 
 #include "gmp-util.h"
@@ -112,10 +111,10 @@ gm_audio_profile_edit_response (GtkDialog *dialog,
     {
       GError *err = NULL;
 
-      gnome_help_display_on_screen ("gnome-audio-profiles",
-                                    "gnome-audio-profiles-profile-edit",
-				    gtk_widget_get_screen (GTK_WIDGET (dialog)),
-				    &err);
+      gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (dialog)),
+		    "ghelp:gnome-audio-profiles?gnome-audio-profiles-edit",
+		    gtk_get_current_event_time (),
+		    &err);
 
       if (err)
         {
diff --git a/profiles/audio-profiles-edit.c b/profiles/audio-profiles-edit.c
index 976d7a9..5c05565 100644
--- a/profiles/audio-profiles-edit.c
+++ b/profiles/audio-profiles-edit.c
@@ -34,7 +34,6 @@
 #include "audio-profile-private.h"
 #include "gmp-util.h"
 #include "audio-profiles-edit.h"
-#include <libgnomeui/libgnomeui.h>
 
 #define MANAGE_STOCK_EDIT "manage-edit"
 
@@ -528,11 +527,10 @@ on_gm_audio_profiles_edit_response (GtkWidget *dialog,
     {
       GError *err = NULL;
 
-      gnome_help_display_on_screen ("gnome-audio-profiles",
-                                    "gnome-audio-profiles-profile-edit",
-				    gtk_widget_get_screen (GTK_WIDGET (dialog)),
-				    &err);
-
+      gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (dialog)),
+		    "ghelp:gnome-audio-profiles?gnome-audio-profiles-profile-edit",
+		    gtk_get_current_event_time (),
+		    &err);
 
       if (err)
         {
diff --git a/profiles/gnome-audio-profiles-properties.c b/profiles/gnome-audio-profiles-properties.c
index 4d2eba2..c8f2f69 100644
--- a/profiles/gnome-audio-profiles-properties.c
+++ b/profiles/gnome-audio-profiles-properties.c
@@ -23,10 +23,10 @@
 #include <config.h>
 #endif
 
+#include <stdlib.h>
 #include <libintl.h>
 #include <gtk/gtk.h>
-#include <libgnome/gnome-program.h>
-#include <libgnomeui/gnome-ui-init.h>
+#include <glib/gi18n.h>
 
 #include "gnome-media-profiles.h"
 #include "audio-profile-private.h"
@@ -43,18 +43,22 @@ main (int argc, char *argv[])
 {
   GtkWidget *widget;
   GConfClient *conf;
-  GnomeProgram *program;
+  GOptionContext *context;
+  GError *error = NULL;
 
-  program = gnome_program_init ("gnome-audio-profiles-properties",
-			        VERSION,
-			        LIBGNOMEUI_MODULE,
-			        argc, argv,
-				GNOME_PARAM_APP_DATADIR, DATADIR,
-			        GNOME_PARAM_NONE);
+  g_thread_init (NULL);
+
+  context = g_option_context_new (NULL);
+  g_option_context_add_group (context, gtk_get_option_group (TRUE));
+  if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
+	  g_print (_("%s\nRun '%s --help' to see a full list of available command line options.\n"),
+		   error->message, argv[0]);
+	  g_error_free (error);
+	  g_option_context_free (context);
+	  exit (1);
+  }
+  g_option_context_free (context);
 
-  /* FIXME: add a comment why we need this at all, until then
-     we comment it out
-  gm_audio_profile_edit_get_type (); */
   glade_register_widget (gm_audio_profile_edit_get_type (),
 			 NULL,
 			 gtk_dialog_build_children,
@@ -75,7 +79,6 @@ main (int argc, char *argv[])
   gtk_main ();
 
   g_object_unref (conf);
-  g_object_unref (program);
 
   return 0;
 }
diff --git a/profiles/gnome-audio-profiles-test.c b/profiles/gnome-audio-profiles-test.c
index b93412a..00db5fc 100644
--- a/profiles/gnome-audio-profiles-test.c
+++ b/profiles/gnome-audio-profiles-test.c
@@ -22,9 +22,9 @@
 #include <config.h>
 #endif
 
+#include <stdlib.h>
 #include <gtk/gtk.h>
 #include <gconf/gconf-client.h>
-#include <libgnomeui/libgnomeui.h>
 #include <gst/gst.h>
 
 #include <profiles/gnome-media-profiles.h>
@@ -148,12 +148,21 @@ main (int argc, char **argv)
 {
   GtkWidget *window, *hbox, *combo, *edit, *test;
   GConfClient *gconf;
-  GnomeProgram *program;
+  GOptionContext *context;
+  GError *error = NULL;
 
-  gst_init (&argc, &argv);
-  program = gnome_program_init ("gnome-audio-profiles-test", VERSION,
-                                LIBGNOMEUI_MODULE, argc, argv,
-                                NULL);
+  g_thread_init (NULL);
+  context = g_option_context_new (NULL);
+  g_option_context_add_group (context, gst_init_get_option_group ());
+  g_option_context_add_group (context, gtk_get_option_group (TRUE));
+  if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
+	  g_print ("%s\nRun '%s --help' to see a full list of available command line options.\n",
+		   error->message, argv[0]);
+	  g_error_free (error);
+	  g_option_context_free (context);
+	  exit (1);
+  }
+  g_option_context_free (context);
 
   gconf = gconf_client_get_default ();
   gnome_media_profiles_init (gconf);
@@ -175,7 +184,5 @@ main (int argc, char **argv)
   gtk_widget_show_all (window);
   gtk_main ();
 
-  g_object_unref (program);
-
   return 0;
 }
diff --git a/profiles/gnome-media-profiles.pc.in b/profiles/gnome-media-profiles.pc.in
index ac14e12..5c2e140 100644
--- a/profiles/gnome-media-profiles.pc.in
+++ b/profiles/gnome-media-profiles.pc.in
@@ -6,7 +6,7 @@ toolsdir=${exec_prefix}/bin
                                                                                 
 Name: GNOME Media Profiles
 Description: Media Profiles describing audio codec settings for output
-Requires: gconf-2.0, gtk+-2.0, libglade-2.0, libgnome-2.0
+Requires: gconf-2.0, gtk+-2.0, libglade-2.0
 Version: @VERSION@
 Libs: -L${libdir} -lgnome-media-profiles
 Cflags: -I${includedir}



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