[gedit] Update smclient from libegg



commit a49305578550d22309a4a927476c18bc7c6894e3
Author: Paolo Borelli <porelli gnome org>
Date:   Fri Jul 24 22:57:02 2009 +0200

    Update smclient from libegg

 gedit/smclient/eggdesktopfile.c   |   73 +++++++++++++++++++++++++++----------
 gedit/smclient/eggdesktopfile.h   |    5 ++-
 gedit/smclient/eggsmclient-xsmp.c |   12 +++---
 3 files changed, 62 insertions(+), 28 deletions(-)
---
diff --git a/gedit/smclient/eggdesktopfile.c b/gedit/smclient/eggdesktopfile.c
index 357e548..6f6b946 100644
--- a/gedit/smclient/eggdesktopfile.c
+++ b/gedit/smclient/eggdesktopfile.c
@@ -1274,8 +1274,8 @@ egg_desktop_file_launchv (EggDesktopFile *desktop_file,
  out:
   if (env)
     {
-      g_strfreev ((char **)env->pdata);
-      g_ptr_array_free (env, FALSE);
+      g_ptr_array_foreach (env, (GFunc)g_free, NULL);
+      g_ptr_array_free (env, TRUE);
     }
   free_document_list (translated_documents);
 
@@ -1386,6 +1386,8 @@ egg_desktop_file_launch (EggDesktopFile *desktop_file,
       free_document_list (documents);
       break;
 
+    case EGG_DESKTOP_FILE_TYPE_UNRECOGNIZED:
+    case EGG_DESKTOP_FILE_TYPE_DIRECTORY:
     default:
       g_set_error (error, EGG_DESKTOP_FILE_ERROR,
 		   EGG_DESKTOP_FILE_ERROR_NOT_LAUNCHABLE,
@@ -1408,23 +1410,9 @@ egg_desktop_file_error_quark (void)
 G_LOCK_DEFINE_STATIC (egg_desktop_file);
 static EggDesktopFile *egg_desktop_file;
 
-/**
- * egg_set_desktop_file:
- * @desktop_file_path: path to the application's desktop file
- *
- * Creates an #EggDesktopFile for the application from the data at
- * @desktop_file_path. This will also call g_set_application_name()
- * with the localized application name from the desktop file, and
- * gtk_window_set_default_icon_name() or
- * gtk_window_set_default_icon_from_file() with the application's
- * icon. Other code may use additional information from the desktop
- * file.
- *
- * Note that for thread safety reasons, this function can only
- * be called once.
- **/
-void
-egg_set_desktop_file (const char *desktop_file_path)
+static void
+egg_set_desktop_file_internal (const char *desktop_file_path,
+                               gboolean set_defaults)
 {
   GError *error = NULL;
 
@@ -1440,7 +1428,7 @@ egg_set_desktop_file (const char *desktop_file_path)
       g_error_free (error);
     }
 
-  if (egg_desktop_file) {
+  if (set_defaults && egg_desktop_file != NULL) {
     /* Set localized application name and default window icon */
     if (egg_desktop_file->name)
       g_set_application_name (egg_desktop_file->name);
@@ -1457,6 +1445,51 @@ egg_set_desktop_file (const char *desktop_file_path)
 }
 
 /**
+ * egg_set_desktop_file:
+ * @desktop_file_path: path to the application's desktop file
+ *
+ * Creates an #EggDesktopFile for the application from the data at
+ * @desktop_file_path. This will also call g_set_application_name()
+ * with the localized application name from the desktop file, and
+ * gtk_window_set_default_icon_name() or
+ * gtk_window_set_default_icon_from_file() with the application's
+ * icon. Other code may use additional information from the desktop
+ * file.
+ * See egg_set_desktop_file_without_defaults() for a variant of this
+ * function that does not set the application name and default window
+ * icon.
+ *
+ * Note that for thread safety reasons, this function can only
+ * be called once, and is mutually exclusive with calling
+ * egg_set_desktop_file_without_defaults().
+ **/
+void
+egg_set_desktop_file (const char *desktop_file_path)
+{
+  egg_set_desktop_file_internal (desktop_file_path, TRUE);
+}
+
+/**
+ * egg_set_desktop_file_without_defaults:
+ * @desktop_file_path: path to the application's desktop file
+ *
+ * Creates an #EggDesktopFile for the application from the data at
+ * @desktop_file_path.
+ * See egg_set_desktop_file() for a variant of this function that
+ * sets the application name and default window icon from the information
+ * in the desktop file.
+ *
+ * Note that for thread safety reasons, this function can only
+ * be called once, and is mutually exclusive with calling
+ * egg_set_desktop_file().
+ **/
+void
+egg_set_desktop_file_without_defaults (const char *desktop_file_path)
+{
+  egg_set_desktop_file_internal (desktop_file_path, FALSE);
+}
+
+/**
  * egg_get_desktop_file:
  * 
  * Gets the application's #EggDesktopFile, as set by
diff --git a/gedit/smclient/eggdesktopfile.h b/gedit/smclient/eggdesktopfile.h
index f8a3d3e..18fe463 100644
--- a/gedit/smclient/eggdesktopfile.h
+++ b/gedit/smclient/eggdesktopfile.h
@@ -150,8 +150,9 @@ typedef enum {
 } EggDesktopFileError;
 
 /* Global application desktop file */
-void            egg_set_desktop_file (const char *desktop_file_path);
-EggDesktopFile *egg_get_desktop_file (void);
+void            egg_set_desktop_file                  (const char *desktop_file_path);
+void            egg_set_desktop_file_without_defaults (const char *desktop_file_path);
+EggDesktopFile *egg_get_desktop_file                  (void);
 
 
 G_END_DECLS
diff --git a/gedit/smclient/eggsmclient-xsmp.c b/gedit/smclient/eggsmclient-xsmp.c
index 1a56156..8bebfba 100644
--- a/gedit/smclient/eggsmclient-xsmp.c
+++ b/gedit/smclient/eggsmclient-xsmp.c
@@ -1052,13 +1052,13 @@ generate_command (char **restart_command, const char *client_id,
 
   if (client_id)
     {
-      g_ptr_array_add (cmd, "--sm-client-id");
+      g_ptr_array_add (cmd, (char *)"--sm-client-id");
       g_ptr_array_add (cmd, (char *)client_id);
     }
 
   if (state_file)
     {
-      g_ptr_array_add (cmd, "--sm-client-state-file");
+      g_ptr_array_add (cmd, (char *)"--sm-client-state-file");
       g_ptr_array_add (cmd, (char *)state_file);
     }
 
@@ -1141,7 +1141,7 @@ array_prop (const char *name, ...)
 
   prop = g_new (SmProp, 1);
   prop->name = (char *)name;
-  prop->type = SmLISTofARRAY8;
+  prop->type = (char *)SmLISTofARRAY8;
 
   vals = g_array_new (FALSE, FALSE, sizeof (SmPropValue));
 
@@ -1175,7 +1175,7 @@ ptrarray_prop (const char *name, GPtrArray *values)
 
   prop = g_new (SmProp, 1);
   prop->name = (char *)name;
-  prop->type = SmLISTofARRAY8;
+  prop->type = (char *)SmLISTofARRAY8;
 
   vals = g_array_new (FALSE, FALSE, sizeof (SmPropValue));
 
@@ -1205,7 +1205,7 @@ string_prop (const char *name, const char *value)
 
   prop = g_new (SmProp, 1);
   prop->name = (char *)name;
-  prop->type = SmARRAY8;
+  prop->type = (char *)SmARRAY8;
 
   prop->num_vals = 1;
   prop->vals = g_new (SmPropValue, 1);
@@ -1230,7 +1230,7 @@ card8_prop (const char *name, unsigned char value)
 
   prop = g_new (SmProp, 1);
   prop->name = (char *)name;
-  prop->type = SmCARD8;
+  prop->type = (char *)SmCARD8;
 
   prop->num_vals = 1;
   prop->vals = g_new (SmPropValue, 2);



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