[Xfce4-commits] <parole:0.2.2> Remove libxfcegui4 dependencies and use libxfce4ui.

Ali Abdallah noreply at xfce.org
Sat Jan 9 14:24:01 CET 2010


Updating branch refs/heads/0.2.2
         to 54aff488b98c4f833954d7369f6251efd24fb9d1 (commit)
       from d15d73d34e73972e2a6b117880c77e78e17b4343 (commit)

commit 54aff488b98c4f833954d7369f6251efd24fb9d1
Author: Ali Abdallah <aliov at xfce.org>
Date:   Sat Jan 9 14:20:58 2010 +0100

    Remove libxfcegui4 dependencies and use libxfce4ui.

 common/parole-common.c       |   41 ++++++++++
 common/parole-common.h       |    9 ++
 configure.ac.in              |    4 +-
 gst/Makefile.am              |    2 +-
 gst/parole-gst.c             |   27 +++++--
 src/Makefile.am              |    7 +-
 src/main.c                   |   11 +--
 src/parole-about.c           |  115 ++++++++++++++--------------
 src/parole-about.h           |    2 +-
 src/parole-mediachooser.c    |    1 -
 src/parole-medialist.c       |   14 +++-
 src/parole-player.c          |  147 ++++++++++++++++++++++++++++++-----
 src/parole-player.h          |    3 +-
 src/parole-plugins-manager.c |    6 +-
 src/parole-session.c         |  174 ------------------------------------------
 src/parole-session.h         |   61 ---------------
 src/parole-utils.h           |    2 +-
 17 files changed, 281 insertions(+), 345 deletions(-)

diff --git a/common/parole-common.c b/common/parole-common.c
index 695e919..f3be90d 100644
--- a/common/parole-common.c
+++ b/common/parole-common.c
@@ -28,8 +28,49 @@
 
 #include <glib.h>
 
+#include <libxfce4util/libxfce4util.h>
+
 #include "parole-common.h"
 
+static void
+parole_dialog_show (GtkWindow *parent, 
+		    GtkMessageType type,
+		    const gchar *window_title,
+		    const gchar *title, 
+		    const gchar *msg)
+{
+    GtkWidget *dialog;
+    
+    dialog = gtk_message_dialog_new_with_markup (parent,
+						 GTK_DIALOG_DESTROY_WITH_PARENT,
+						 type,
+						 GTK_BUTTONS_CLOSE,
+						 "<span size='larger'><b>%s</b></span>",
+						 title);
+						 
+    gtk_window_set_title (GTK_WINDOW (dialog), window_title);
+    
+    gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), "%s", msg);
+
+
+    g_signal_connect_swapped (dialog,
+			      "response",
+			      G_CALLBACK (gtk_widget_destroy),
+			      dialog);
+
+    gtk_widget_show_all (dialog);
+}
+
+void parole_dialog_info	(GtkWindow *parent, const gchar *title,	const gchar *msg)
+{
+    parole_dialog_show (parent, GTK_MESSAGE_INFO, _("Message"), title, msg);
+}
+
+void parole_dialog_error (GtkWindow *parent, const gchar *title, const gchar *msg)
+{
+    parole_dialog_show (parent, GTK_MESSAGE_ERROR, _("Error"), title, msg);
+}
+
 void parole_window_busy_cursor		(GdkWindow *window)
 {
     GdkCursor *cursor;
diff --git a/common/parole-common.h b/common/parole-common.h
index 1cae844..62617f6 100644
--- a/common/parole-common.h
+++ b/common/parole-common.h
@@ -24,8 +24,17 @@
 #include <gtk/gtk.h>
 #include <gdk/gdk.h>
 
+void		parole_dialog_info			(GtkWindow *parent,
+							 const gchar *title,
+							 const gchar *msg);
+
+void		parole_dialog_error			(GtkWindow *parent,
+							 const gchar *title,
+							 const gchar *msg);
+
 void		parole_window_busy_cursor		(GdkWindow *window);
 
 void		parole_window_invisible_cursor		(GdkWindow *window);
 
+
 #endif /* __PAROLE_COMMON_ */
diff --git a/configure.ac.in b/configure.ac.in
index 2af00ae..f8d873f 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -73,7 +73,7 @@ m4_define([gstreamer_minimum_version], [0.10.11])
 m4_define([dbus_minimum_version], [0.60])
 m4_define([dbus_glib_minimum_version], [0.70])
 
-m4_define([libxfcegui4_minimum_version],[4.6.0])
+m4_define([libxfce4ui_minimum_version],[4.7.0])
 m4_define([libxfce4util_minimum_version],[4.6.0])
 
 m4_define([libnotify_minimum_version], [0.4.1])
@@ -93,7 +93,7 @@ XDT_CHECK_PACKAGE([GST_INTERFACES], [gstreamer-interfaces-0.10], [gstreamer_mini
 XDT_CHECK_PACKAGE([DBUS], [dbus-1], [dbus_minimum_version])
 XDT_CHECK_PACKAGE([DBUS_GLIB], [dbus-glib-1], [dbus_glib_minimum_version])
 
-XDT_CHECK_PACKAGE([LIBXFCE4GUI], [libxfcegui4-1.0],[libxfcegui4_minimum_version])
+XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1],[libxfce4ui_minimum_version])
 XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0],[libxfce4util_minimum_version])
 
 #=======================================================#
diff --git a/gst/Makefile.am b/gst/Makefile.am
index 891ec29..14db948 100644
--- a/gst/Makefile.am
+++ b/gst/Makefile.am
@@ -26,7 +26,7 @@ libparolegst_la_CFLAGS =		\
 	$(GST_VIDEO_CFLAGS)             \
         $(GST_INTERFACES_CFLAGS)	\
 	$(GTHREAD_CFLAGS)               \
-	$(LIBXFCE4GUI_CFLAGS)
+	$(LIBXFCE4UI_CFLAGS)
 
 libparolegst_la_LIBADD =		\
 	$(top_builddir)/parole/libparole.la\
diff --git a/gst/parole-gst.c b/gst/parole-gst.c
index 35db181..6fbe2d0 100644
--- a/gst/parole-gst.c
+++ b/gst/parole-gst.c
@@ -34,7 +34,7 @@
 #include <gst/video/video.h>
 
 #include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
 
 #include <gdk/gdkx.h>
 
@@ -1490,8 +1490,11 @@ parole_gst_check_state_change_timeout (gpointer data)
     
     if ( gst->priv->state != gst->priv->target )
     {
-	gboolean ret_val = 
-	    xfce_confirm (_("The stream is taking too much time to load"), GTK_STOCK_OK, _("Stop"));
+	gboolean ret_val = xfce_dialog_confirm (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gst))),
+						GTK_STOCK_YES,
+						_("Stop"),
+						_("The stream is taking too much time to load"), 
+						NULL);
 	    
 	if ( ret_val )
 	{
@@ -1680,9 +1683,13 @@ parole_gst_constructed (GObject *object)
  
     if ( G_UNLIKELY (gst->priv->playbin == NULL) )
     {
-	xfce_err (_("Unable to load playbin GStreamer plugin"
-		    ", check your GStreamer installation"));
-		    
+	GError *error;
+	error = g_error_new (0, 0, "%s", _("Unable to load playbin GStreamer plugin"
+					    ", check your GStreamer installation"));
+					    
+	xfce_dialog_show_error (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gst))),
+				error, NULL);
+	g_error_free (error);
 	g_error ("playbin load failed");
     }
     
@@ -1700,8 +1707,12 @@ parole_gst_constructed (GObject *object)
 	
 	if ( G_UNLIKELY (gst->priv->video_sink == NULL) )
 	{
-	    xfce_err (_("Unable to load video GStreamer plugin"
-		      ", check your GStreamer installation"));
+	    GError *error;
+	    error = g_error_new (0, 0, "%s", _("Unable to load video GStreamer plugin"
+					      ", check your GStreamer installation"));
+	    xfce_dialog_show_error (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gst))),
+				error, NULL);
+	    g_error_free (error);
 	    g_error ("ximagesink load failed");
 	}
     }
diff --git a/src/Makefile.am b/src/Makefile.am
index 898df79..b3288a2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -9,6 +9,7 @@ INCLUDES =					\
 	-I$(top_srcdir)/dbus	                \
 	-I$(top_srcdir)/common	                \
 	-DLOCALEDIR=\"$(localedir)\"		\
+	-DDESKTOPDIR=\"$(datadir)/applications\"\
 	-DG_LOG_DOMAIN=\"parole\"		\
 	-DPAROLE_PLUGINS_DIR=\"$(libdir)/parole-$(PAROLE_VERSION_API)\"\
 	-DPAROLE_PLUGINS_DATA_DIR=\"$(datadir)/parole/parole-plugins-$(PAROLE_VERSION_API)\"\
@@ -17,7 +18,7 @@ INCLUDES =					\
 	$(GIO_CFLAGS)				\
 	$(GMODULE_CFLAGS)			\
         $(DBUS_GLIB_CFLAGS)                     \
-        $(LIBXFCE4GUI_CFLAGS)                   \
+        $(LIBXFCE4UI_CFLAGS)                    \
 	$(GST_VIDEO_CFLAGS)			\
 	$(GST_INTERFACES_CFLAGS)		\
 	$(TAGLIBC_CFLAGS)
@@ -65,8 +66,6 @@ parole_SOURCES =				\
 	parole-open-location.h			\
 	parole-disc-menu.c			\
 	parole-disc-menu.h			\
-	parole-session.c			\
-	parole-session.h			\
 	parole-button.c				\
 	parole-button.h				\
 	parole-plugin-player.c			\
@@ -84,7 +83,7 @@ parole_LDADD =					\
 	$(GIO_LIBS)				\
 	$(GMODULE_LIBS)				\
         $(DBUS_GLIB_LIBS)                       \
-        $(LIBXFCE4GUI_LIBS)                     \
+        $(LIBXFCE4UI_LIBS)                      \
 	$(GST_VIDEO_LIBS)			\
 	$(GST_INTERFACES_LIBS)			\
 	$(TAGLIBC_LIBS)
diff --git a/src/main.c b/src/main.c
index d64dc3f..ec74bb0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -43,7 +43,6 @@
 #include "parole-player.h"
 #include "parole-plugins-manager.h"
 #include "parole-utils.h"
-#include "parole-session.h"
 #include "parole-dbus.h"
 #include "parole-builder.h"
 #include "parole-rc-utils.h"
@@ -185,7 +184,6 @@ xv_option_given (const gchar *name, const gchar *value, gpointer data, GError **
 int main (int argc, char **argv)
 {
     ParolePlayer *player;
-    ParoleSession *session;
     ParolePluginsManager *plugins;
     GtkBuilder *builder;
     GOptionContext *ctx;
@@ -298,14 +296,10 @@ int main (int argc, char **argv)
     {
 	builder = parole_builder_get_main_interface ();
 	parole_dbus_register_name (PAROLE_DBUS_NAME);
-	session = parole_session_get ();
 	
-	if ( client_id )
-	    parole_session_set_client_id (session, client_id);
-	    
-	parole_session_real_init (session);
 	parole_setup ();
-	player = parole_player_new ();
+	player = parole_player_new (client_id);
+	g_free (client_id);
 
 	if ( filenames && filenames[0] != NULL )
 	{
@@ -350,7 +344,6 @@ int main (int argc, char **argv)
 	
 	parole_dbus_release_name (PAROLE_DBUS_NAME);
 	g_object_unref (plugins);
-	g_object_unref (session);
     }
 
     gst_deinit ();
diff --git a/src/parole-about.c b/src/parole-about.c
index 96abcf0..77961c0 100644
--- a/src/parole-about.c
+++ b/src/parole-about.c
@@ -27,73 +27,76 @@
 #include <string.h>
 
 #include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
 
 #include "parole-about.h"
 #include "parole-utils.h"
 
-void  parole_about (void)
+#if !GTK_CHECK_VERSION (2, 18, 0)
+static void
+parole_link_browser (GtkAboutDialog *about, const gchar *link, gpointer data)
 {
-    XfceAboutInfo *info;
-    GtkWidget *dialog;
-    gint x, y;
-    GdkPixbuf *icon;
-    guint n;
-
-    static const struct
-    {
-	gchar *name, *email, *language;
-    } 	
-    translators[] = 
+    gchar *cmd;
+    
+    cmd = g_strdup_printf ("%s %s","xdg-open", link);
+    
+    if ( !g_spawn_command_line_async (cmd, NULL) )
     {
-	{"astur", "malditoastur at gmail.com", "ast",},
-	{"Carles Muñoz Gorriz", "carlesmu at internautas.org", "ca.po",},
-	{"Per Kongstad", "p_kongstad at op.pl", "da.po",},
-	{"Christoph Wickert", "cwickert at fedoraproject.org", "de.po",},
-	{"elega", "elega at elega.com.ar","es",},
-	{"Piarres Beobide", "pi+debian at beobide.net", "eu",},
-	{"Douart Patrick", "patrick.2 at laposte.net", "fr",},
-	{"Leandro Regueiro", "leandro.regueiro at gmail.com", "gl",},
-	{"Andhika Padmawan", "andhika.padmawan at gmail.com", "id",},
-	{"Masato Hashimoto", "cabezon.hashimoto at gmail.com", "ja",},
-	{"Rihards Prieditis", "rprieditis at gmail.com", "lv",},
-	{"Mario Blättermann", "mariobl at gnome.org", "nl",},
-	{"Sérgio Marques", "smarquespt at gmail.com", "pt",},
-	{"Vlad Vasilev", "lortwer at gmail.com", "ru",},
-	{"Robert Hartl", "hartl.robert at gmail.com", "sk",},
-	{"Samed Beyribey", "ras0ir at eventualis.org", "tr",},
-	{"Motsyo Gennadi", "drool at altlinux.ru", "uk",},
-	{"Hunt Xu", "huntxu at live.cn", "zh_CN",},
-	
-    };
+        g_free (cmd);
+        cmd = g_strdup_printf ("%s %s","xfbrowser4", link);
+        g_spawn_command_line_async (cmd, NULL);
+    }
+    g_free (cmd);
+        
+}
 
-    info = xfce_about_info_new ("Parole", VERSION, _("Parole Media Player"),
-                                XFCE_COPYRIGHT_TEXT ("2009", "Ali Abdallah"), 
-				XFCE_LICENSE_GPL);
+static void
+parole_link_mailto (GtkAboutDialog *about, const gchar *link, gpointer data)
+{
+    gchar *cmd = g_strdup_printf( "%s %s", "xdg-email", link);
 
-    xfce_about_info_set_homepage (info, "http://goodies.xfce.org/projects/applications/parole");
-    xfce_about_info_add_credit (info, "Ali Abdallah", "aliov at xfce.org", _("Author/Maintainer"));
-  
+    g_spawn_command_line_async (cmd, NULL);
+    
+    g_free (cmd);
+}
+#endif /*GTK_CHECK_VERSION (2, 18, 0)*/
 
-    for (n = 0; n < G_N_ELEMENTS (translators); ++n) 
+void  parole_about (GtkWindow *parent)
+{
+    GdkPixbuf *logo;
+    
+    static const gchar *authors[] = 
     {
-	gchar *s;
-	s = g_strdup_printf (_("Translator (%s)"), translators[n].language);
-	xfce_about_info_add_credit (info, translators[n].name, translators[n].email, s);
-	g_free (s);
-    }
-
-    gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &x, &y);
-    icon = parole_icon_load ("parole", x);
+	"Ali Abdallah <aliov at xfce.org",
+	NULL,
+    };
+    
+    static const gchar *documenters[] = 
+    {
+	"Ali Abdallah <aliov at xfce.org",
+	NULL,
+    };
     
-    dialog = xfce_about_dialog_new_with_values (NULL, info, icon);
+#if !GTK_CHECK_VERSION (2, 18, 0)
+    gtk_about_dialog_set_url_hook (parole_link_browser, NULL, NULL);
+    gtk_about_dialog_set_email_hook (parole_link_mailto, NULL, NULL);
+#endif
     
-	
-    gtk_dialog_run (GTK_DIALOG (dialog));
-    gtk_widget_destroy (dialog);
-
-    xfce_about_info_free (info);
+    logo = parole_icon_load ("parole", 128);
     
-    if (icon)
-	g_object_unref (G_OBJECT (icon));
+    gtk_show_about_dialog (parent,
+                           "authors", authors,
+                           "comments", _("Parole Media Player"),
+			   "documenters", documenters,
+                           "copyright", "Copyright \302\251 2009-2010 Ali Abdallah",
+                           "license", XFCE_LICENSE_GPL,
+                           "logo", logo,
+                           "program-name", PACKAGE_NAME,
+                           "translator-credits", _("translator-credits"),
+                           "version", PACKAGE_VERSION,
+                           "website", "http://goodies.xfce.org/projects/applications/parole",
+                           "website-label", _("Visit Parole website"),
+                            NULL);
+
+    if (logo)
+	g_object_unref (G_OBJECT (logo));
 }
diff --git a/src/parole-about.h b/src/parole-about.h
index cb89c42..da4251e 100644
--- a/src/parole-about.h
+++ b/src/parole-about.h
@@ -23,7 +23,7 @@
 
 #include <gtk/gtk.h>
 
-void 		parole_about	(void);
+void 		parole_about	(GtkWindow *parent);
 
 
 #endif /* __PAROLE_ABOUT_H */
diff --git a/src/parole-mediachooser.c b/src/parole-mediachooser.c
index ba6c086..5138f3f 100644
--- a/src/parole-mediachooser.c
+++ b/src/parole-mediachooser.c
@@ -30,7 +30,6 @@
 #include <glib.h>
 
 #include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
 
 #include <parole/parole-file.h>
 
diff --git a/src/parole-medialist.c b/src/parole-medialist.c
index c56e816..9bd9431 100644
--- a/src/parole-medialist.c
+++ b/src/parole-medialist.c
@@ -26,6 +26,8 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <unistd.h>
+
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 #include <glib.h>
@@ -33,7 +35,6 @@
 #include <gio/gio.h>
 
 #include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
 
 #include <parole/parole-file.h>
 
@@ -450,7 +451,12 @@ void parole_media_list_save_playlist_cb (GtkButton *button, ParolePlaylistSave *
     
     if ( g_access (dirname, W_OK) == -1 )
     {
-	xfce_err ("%s %s %s", _("Error saving playlist file"), dirname, _("Permission denied"));
+	gchar *msg;
+	msg = g_strdup_printf ("%s %s", dirname, _("Permission denied"));
+	parole_dialog_error (GTK_WINDOW (gtk_widget_get_toplevel (data->list->priv->view)),
+			     _("Error saving playlist file"),
+			     msg);
+	g_free (msg);
 	goto out;
     }
     
@@ -459,7 +465,9 @@ void parole_media_list_save_playlist_cb (GtkButton *button, ParolePlaylistSave *
 	format = parole_pl_parser_guess_format_from_extension (filename);
 	if ( format == PAROLE_PL_FORMAT_UNKNOWN )
 	{
-	    xfce_info ("%s", _("Unknown playlist format, Please select a support playlist format"));
+	    parole_dialog_info (GTK_WINDOW (gtk_widget_get_toplevel (data->list->priv->view)),
+				_("Unknown playlist format"),
+				_("Please chooser a supported playlist format"));
 	    goto out;
 	}
     }
diff --git a/src/parole-player.c b/src/parole-player.c
index 467e6b3..3c837c1 100644
--- a/src/parole-player.c
+++ b/src/parole-player.c
@@ -30,12 +30,14 @@
 #include <X11/XF86keysym.h>
 #endif
 
+#include <X11/Xatom.h>
+
 #include <gdk/gdkx.h>
 #include <gdk/gdkkeysyms.h>
 #include <gtk/gtk.h>
 
 #include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
+#include <libxfce4ui/libxfce4ui.h>
 
 #include <dbus/dbus-glib.h>
 
@@ -57,7 +59,6 @@
 #include "parole-conf.h"
 #include "parole-rc-utils.h"
 #include "parole-utils.h"
-#include "parole-session.h"
 #include "parole-debug.h"
 #include "parole-button.h"
 #include "enum-gtypes.h"
@@ -179,7 +180,8 @@ void		ratio_16_9_toggled_cb			(GtkWidget *widget,
 void		ratio_20_9_toggled_cb			(GtkWidget *widget,
 							 ParolePlayer *player);
 
-void	        parole_show_about			(GtkWidget *widget);
+void	        parole_show_about			(GtkWidget *widget,
+							 ParolePlayer *player);
 
 gboolean	parole_player_key_press 		(GtkWidget *widget, 
 							 GdkEventKey *ev, 
@@ -206,10 +208,12 @@ struct ParolePlayerPrivate
     ParoleScreenSaver   *screen_saver;
     ParoleConf          *conf;
     ParoleDiscMenu      *disc_menu;
-    ParoleSession       *session;
 #ifdef HAVE_XF86_KEYSYM
     ParoleButton        *button;
 #endif
+
+    XfceSMClient        *sm_client;
+    gchar               *client_id;
     
     GtkFileFilter       *video_filter;
     GtkRecentManager    *recent;
@@ -252,11 +256,17 @@ struct ParolePlayerPrivate
         
 };
 
+enum
+{
+    PROP_0,
+    PROP_CLIENT_ID
+};
+
 G_DEFINE_TYPE (ParolePlayer, parole_player, G_TYPE_OBJECT)
 
-void parole_show_about	(GtkWidget *widget)
+void parole_show_about	(GtkWidget *widget, ParolePlayer *player)
 {
-    parole_about ();
+    parole_about (GTK_WINDOW (player->priv->window));
 }
 
 void ratio_none_toggled_cb (GtkWidget *widget, ParolePlayer *player)
@@ -871,7 +881,7 @@ parole_player_range_value_changed (GtkRange *range, ParolePlayer *player)
 static void
 parole_player_error_cb (ParoleGst *gst, const gchar *error, ParolePlayer *player)
 {
-    xfce_err ("%s", error);
+    parole_dialog_error (GTK_WINDOW (player->priv->window), _("GStreamer backend error"), error);
     parole_screen_saver_uninhibit (player->priv->screen_saver);
     parole_player_stopped (player);
 }
@@ -1375,6 +1385,13 @@ parole_player_screen_size_change_changed_cb (GdkScreen *screen, ParolePlayer *pl
 }
 
 static void
+parole_player_sm_quit_requested_cb (ParolePlayer *player)
+{
+    player->priv->exit = TRUE;
+    parole_gst_terminate (PAROLE_GST (player->priv->gst));
+}
+
+static void
 parole_player_finalize (GObject *object)
 {
     ParolePlayer *player;
@@ -1392,6 +1409,11 @@ parole_player_finalize (GObject *object)
     g_object_unref (player->priv->disc_menu);
     g_object_unref (player->priv->screen_saver);
     
+    if ( player->priv->client_id )
+	g_free (player->priv->client_id);
+	
+    g_object_unref (player->priv->sm_client);
+    
 #ifdef HAVE_XF86_KEYSYM
     g_object_unref (player->priv->button);
 #endif
@@ -1401,12 +1423,104 @@ parole_player_finalize (GObject *object)
     G_OBJECT_CLASS (parole_player_parent_class)->finalize (object);
 }
 
+static void parole_player_set_property (GObject *object,
+				        guint prop_id,
+				        const GValue *value,
+				        GParamSpec *pspec)
+{
+    ParolePlayer *player;
+    player = PAROLE_PLAYER (object);
+
+    switch (prop_id)
+    {
+	case PROP_CLIENT_ID:
+	    player->priv->client_id = g_value_dup_string (value);
+	    break;
+	default:
+	    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+	    break;
+    }
+}
+
+static void parole_player_get_property (GObject *object,
+				        guint prop_id,
+				        GValue *value,
+				        GParamSpec *pspec)
+{
+    ParolePlayer *player;
+    player = PAROLE_PLAYER (object);
+
+    switch (prop_id)
+    {
+	case PROP_CLIENT_ID:
+	    g_value_set_string (value, player->priv->client_id);
+	    break;
+	default:
+	    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+	    break;
+    }
+}
+
+/**
+ * Get the SM client
+ **/
+static void
+parole_player_constructed (GObject *object)
+{
+    ParolePlayer *player;
+    gchar *current_dir;
+    
+    const gchar *restart_command[] =
+    {
+        "parole",
+        "--new-instance",
+        NULL
+    };
+    
+    player = PAROLE_PLAYER (object);
+
+    current_dir = g_get_current_dir ();
+    
+    player->priv->sm_client = xfce_sm_client_get_full (XFCE_SM_CLIENT_RESTART_NORMAL,
+						       XFCE_SM_CLIENT_PRIORITY_DEFAULT,
+						       player->priv->client_id,
+						       current_dir,
+						       restart_command,
+						       DESKTOPDIR "/" PACKAGE_NAME ".desktop");
+				      
+    if ( xfce_sm_client_connect (player->priv->sm_client, NULL ) )
+    {
+	g_signal_connect_swapped (player->priv->sm_client, "quit-requested",
+				  G_CALLBACK (parole_player_sm_quit_requested_cb), player);
+    }
+    
+    g_free (current_dir);
+}
+
 static void
 parole_player_class_init (ParolePlayerClass *klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
+    object_class->constructed = parole_player_constructed;
     object_class->finalize = parole_player_finalize;
+    object_class->set_property = parole_player_set_property;
+    object_class->get_property = parole_player_get_property;
+    
+    
+    /**
+     * ParolePlayer:client-id:
+     * 
+     * Sm Manager client ID
+     * Since: 0.2.2
+     **/
+    g_object_class_install_property (object_class,
+				     PROP_CLIENT_ID,
+				     g_param_spec_string ("client-id",
+							  NULL, 
+							  NULL,
+							  NULL,
+							  G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY));
 
     g_type_class_add_private (klass, sizeof (ParolePlayerPrivate));
     
@@ -1593,13 +1707,6 @@ parole_player_button_pressed_cb (ParoleButton *button, ParoleButtonKey key, Paro
 #endif
 
 static void
-parole_player_session_die_cb (ParolePlayer *player)
-{
-    player->priv->exit = TRUE;
-    parole_gst_terminate (PAROLE_GST (player->priv->gst));
-}
-
-static void
 parole_gst_set_default_aspect_ratio (ParolePlayer *player, GtkBuilder *builder)
 {
     ParoleAspectRatio ratio;
@@ -1770,6 +1877,9 @@ parole_player_init (ParolePlayer *player)
     
     player->priv = PAROLE_PLAYER_GET_PRIVATE (player);
     
+    player->priv->client_id = NULL;
+    player->priv->sm_client = NULL;
+    
     player->priv->bus = parole_g_session_bus_get ();
     
     player->priv->video_filter = parole_get_supported_video_filter ();
@@ -1782,11 +1892,6 @@ parole_player_init (ParolePlayer *player)
     g_signal_connect_swapped (player->priv->conf, "notify::reset-saver",
 			      G_CALLBACK (parole_player_reset_saver_changed_cb), player);
     
-    player->priv->session = parole_session_get ();
-    
-    g_signal_connect_swapped (player->priv->session, "die",
-			      G_CALLBACK (parole_player_session_die_cb), player);
-    
     player->priv->gst = parole_gst_new (FALSE, player->priv->conf);
 
     player->priv->status = parole_statusbar_new ();
@@ -1955,10 +2060,10 @@ parole_player_init (ParolePlayer *player)
 }
 
 ParolePlayer *
-parole_player_new (void)
+parole_player_new (const gchar *client_id)
 {
     ParolePlayer *player = NULL;
-    player = g_object_new (PAROLE_TYPE_PLAYER, NULL);
+    player = g_object_new (PAROLE_TYPE_PLAYER, "client-id", client_id, NULL);
     return player;
 }
 
diff --git a/src/parole-player.h b/src/parole-player.h
index 8060a22..3fdf46b 100644
--- a/src/parole-player.h
+++ b/src/parole-player.h
@@ -46,7 +46,8 @@ typedef struct
 } ParolePlayerClass;
 
 GType        			 parole_player_get_type        (void) G_GNUC_CONST;
-ParolePlayer       		*parole_player_new             (void);
+
+ParolePlayer       		*parole_player_new             (const gchar *client_id);
 
 ParoleMediaList			*parole_player_get_media_list  (ParolePlayer *player);
 
diff --git a/src/parole-plugins-manager.c b/src/parole-plugins-manager.c
index 9c9a638..c82fb5c 100644
--- a/src/parole-plugins-manager.c
+++ b/src/parole-plugins-manager.c
@@ -29,7 +29,6 @@
 #include <glib.h>
 
 #include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
 
 #include <parole/parole-provider-plugin.h>
 
@@ -42,6 +41,7 @@
 #include "parole-module.h"
 
 #include "gst/parole-gst.h"
+#include "common/parole-common.h"
 
 #define PAROLE_PLUGIN_EXT = ".desktop"
 
@@ -409,7 +409,9 @@ parole_plugins_manager_show_plugins_pref (GtkWidget *widget, ParolePluginsManage
     /*No plugins found*/
     if ( manager->priv->array->len == 0 )
     {
-	xfce_info ("%s", _("No installed plugins found on this system")); 
+	parole_dialog_info (GTK_WINDOW (gtk_widget_get_toplevel (manager->priv->main_nt)),
+			    _("No installed plugins found on this system"), 
+			    _("No installed plugins found on this system")); 
 	return;
     }
     
diff --git a/src/parole-session.c b/src/parole-session.c
deleted file mode 100644
index 3c973ee..0000000
--- a/src/parole-session.c
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * * Copyright (C) 2009 Ali <aliov at xfce.org>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include <libxfce4util/libxfce4util.h>
-#include <libxfcegui4/libxfcegui4.h>
-
-#include "parole-session.h"
-
-static void parole_session_finalize   (GObject *object);
-
-#define PAROLE_SESSION_GET_PRIVATE(o) \
-(G_TYPE_INSTANCE_GET_PRIVATE ((o), PAROLE_TYPE_SESSION, ParoleSessionPrivate))
-
-struct ParoleSessionPrivate
-{
-    SessionClient *client;
-    gboolean	   managed;
-};
-
-enum
-{
-    DIE,
-    SAVE_STATE,
-    LAST_SIGNAL
-};
-
-static guint signals [LAST_SIGNAL] = { 0 };
-
-G_DEFINE_TYPE (ParoleSession, parole_session, G_TYPE_OBJECT)
-
-static void
-parole_session_die (gpointer client_data)
-{
-    ParoleSession *session;
-    
-    session = parole_session_get ();
-    
-    if ( session->priv->managed )
-	g_signal_emit (G_OBJECT (session), signals [DIE], 0);
-}
-
-static void
-parole_session_class_init (ParoleSessionClass *klass)
-{
-    GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
-    signals [DIE] = 
-        g_signal_new ("die",
-                      PAROLE_TYPE_SESSION,
-                      G_SIGNAL_RUN_LAST,
-                      G_STRUCT_OFFSET(ParoleSessionClass, die),
-                      NULL, NULL,
-                      g_cclosure_marshal_VOID__VOID,
-                      G_TYPE_NONE, 0, G_TYPE_NONE);
-		      
-
-    signals [SAVE_STATE] = 
-        g_signal_new ("save-state",
-                      PAROLE_TYPE_SESSION,
-                      G_SIGNAL_RUN_LAST,
-                      G_STRUCT_OFFSET(ParoleSessionClass, save_state),
-                      NULL, NULL,
-                      g_cclosure_marshal_VOID__VOID,
-                      G_TYPE_NONE, 0, G_TYPE_NONE);
-
-    object_class->finalize = parole_session_finalize;
-
-    g_type_class_add_private (klass, sizeof (ParoleSessionPrivate));
-}
-
-static void
-parole_session_init (ParoleSession *session)
-{
-    session->priv = PAROLE_SESSION_GET_PRIVATE (session);
-    
-    session->priv->client = NULL;
-    
-    session->priv->client = client_session_new_full (NULL,
-						     SESSION_RESTART_NEVER,
-						     40,
-						     NULL,
-						     (gchar *) PACKAGE_NAME,
-						     NULL,
-						     NULL,
-						     NULL,
-						     NULL,
-						     NULL,
-						     NULL);
-						     
-    if ( G_UNLIKELY (session->priv->client == NULL ) )
-    {
-	g_warning ("Failed to connect to session manager");
-	return;
-    }
-    
-    session->priv->client->die     = parole_session_die;
-}
-
-static void
-parole_session_finalize (GObject *object)
-{
-    ParoleSession *session;
-
-    session = PAROLE_SESSION (object);
-    
-    if ( session->priv->client != NULL )
-    {
-	client_session_free (session->priv->client);
-    }
-
-    G_OBJECT_CLASS (parole_session_parent_class)->finalize (object);
-}
-
-ParoleSession *
-parole_session_get (void)
-{
-    static gpointer parole_session_obj = NULL;
-    
-    if ( G_LIKELY (parole_session_obj != NULL ) )
-    {
-	g_object_ref (parole_session_obj);
-    }
-    else
-    {
-	parole_session_obj = g_object_new (PAROLE_TYPE_SESSION, NULL);
-	g_object_add_weak_pointer (parole_session_obj, &parole_session_obj);
-    }
-    
-    return PAROLE_SESSION (parole_session_obj);
-}
-
-void parole_session_real_init       (ParoleSession *session)
-{
-    g_return_if_fail (PAROLE_IS_SESSION (session));
-    g_return_if_fail (session->priv->managed == FALSE);
-    
-    session->priv->managed = session_init (session->priv->client);
-}
-
-void parole_session_set_client_id (ParoleSession *session, const gchar *client_id)
-{
-    g_return_if_fail (PAROLE_IS_SESSION (session));
-    g_return_if_fail (session->priv->managed == FALSE);
-    
-    if ( G_UNLIKELY (session->priv->client == NULL) )
-	return;
-    
-    client_session_set_client_id (session->priv->client, client_id);
-}
diff --git a/src/parole-session.h b/src/parole-session.h
deleted file mode 100644
index b35593c..0000000
--- a/src/parole-session.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * * Copyright (C) 2009 Ali <aliov at xfce.org>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#ifndef __PAROLE_SESSION_H
-#define __PAROLE_SESSION_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define PAROLE_TYPE_SESSION        (parole_session_get_type () )
-#define PAROLE_SESSION(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), PAROLE_TYPE_SESSION, ParoleSession))
-#define PAROLE_IS_SESSION(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAROLE_TYPE_SESSION))
-
-typedef struct ParoleSessionPrivate ParoleSessionPrivate;
-
-typedef struct
-{
-    GObject         		parent;
-    ParoleSessionPrivate       *priv;
-    
-} ParoleSession;
-
-typedef struct
-{
-    GObjectClass 		parent_class;
-    
-    void			(*die)			       (ParoleSession *session);
-    
-    void			(*save_state)		       (ParoleSession *session);
-    
-} ParoleSessionClass;
-
-GType        			parole_session_get_type        (void) G_GNUC_CONST;
-
-ParoleSession       	       *parole_session_get             (void);
-
-void				parole_session_real_init       (ParoleSession *session);
-
-void 				parole_session_set_client_id   (ParoleSession *session, 
-								const gchar *client_id);
-G_END_DECLS
-
-#endif /* __PAROLE_SESSION_H */
diff --git a/src/parole-utils.h b/src/parole-utils.h
index a7e216e..6139e5b 100644
--- a/src/parole-utils.h
+++ b/src/parole-utils.h
@@ -39,7 +39,7 @@ gboolean	parole_is_uri_disc			(const gchar *uri);
 GdkPixbuf      *parole_icon_load			(const gchar *icon_name,
 							 gint size);
 
-void			 parole_get_media_files		(GtkFileFilter *filter,
+void		parole_get_media_files			(GtkFileFilter *filter,
 							 const gchar *path,
 							 gboolean recursive,
 							 GSList **list);



More information about the Xfce4-commits mailing list