]> www.fi.muni.cz Git - evince.git/blobdiff - cut-n-paste/smclient/eggsmclient-xsmp.c
Fixed minor bug, it returned NULL when expecting gboolean.
[evince.git] / cut-n-paste / smclient / eggsmclient-xsmp.c
index e4b11f6288d64e84d3eeff238d343feabd866d19..20cd23b10c36aef19d507c1eca345e49165fc7d6 100644 (file)
@@ -17,8 +17,8 @@
  *
  * You should have received a copy of the GNU Library General Public
  * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
+ * Boston, MA 02110-1301, USA.
  */
 
 #include "config.h"
@@ -36,6 +36,7 @@
 #include <X11/SM/SMlib.h>
 
 #include <gdk/gdk.h>
+#include <gdk/gdkx.h>
 
 #define EGG_TYPE_SM_CLIENT_XSMP            (egg_sm_client_xsmp_get_type ())
 #define EGG_SM_CLIENT_XSMP(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), EGG_TYPE_SM_CLIENT_XSMP, EggSMClientXSMP))
@@ -367,7 +368,11 @@ sm_client_xsmp_startup (EggSMClient *client,
       free (ret_client_id);
 
       gdk_threads_enter ();
+#if !GTK_CHECK_VERSION(2,91,7) && !GTK_CHECK_VERSION(3,0,0)
       gdk_set_sm_client_id (xsmp->client_id);
+#else
+      gdk_x11_set_sm_client_id (xsmp->client_id);
+#endif
       gdk_threads_leave ();
 
       g_debug ("Got client ID \"%s\"", xsmp->client_id);
@@ -795,10 +800,14 @@ save_state (EggSMClientXSMP *xsmp)
   if (desktop_file)
     {
       GKeyFile *merged_file;
+      char *desktop_file_path;
 
       merged_file = g_key_file_new ();
-      if (g_key_file_load_from_file (merged_file,
-                                    egg_desktop_file_get_source (desktop_file),
+      desktop_file_path =
+       g_filename_from_uri (egg_desktop_file_get_source (desktop_file),
+                            NULL, NULL);
+      if (desktop_file_path &&
+         g_key_file_load_from_file (merged_file, desktop_file_path,
                                     G_KEY_FILE_KEEP_COMMENTS |
                                     G_KEY_FILE_KEEP_TRANSLATIONS, NULL))
        {
@@ -841,8 +850,11 @@ save_state (EggSMClientXSMP *xsmp)
                                 EGG_DESKTOP_FILE_KEY_EXEC,
                                 exec);
          g_free (exec);
-
        }
+      else
+       desktop_file = NULL;
+
+      g_free (desktop_file_path);
     }
 
   /* Now write state_file to disk. (We can't use mktemp(), because
@@ -1045,13 +1057,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);
     }
 
@@ -1134,7 +1146,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));
 
@@ -1168,7 +1180,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));
 
@@ -1198,7 +1210,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);
@@ -1223,7 +1235,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);