gnome-session r4912 - in trunk: . gnome-session



Author: mccann
Date: Tue Aug  5 02:20:14 2008
New Revision: 4912
URL: http://svn.gnome.org/viewvc/gnome-session?rev=4912&view=rev

Log:
2008-08-04  William Jon McCann  <jmccann redhat com>

	* gnome-session/gsm-app.c (gsm_app_peek_is_conditionally_disabled):
	* gnome-session/gsm-app.h:
	* gnome-session/gsm-autostart-app.c (is_conditionally_disabled),
	(is_disabled), (gsm_autostart_app_class_init):
	* gnome-session/gsm-manager.c (_start_app):
	Add gsm_app_is_conditionally_disabled.  Remove AutostartCondition
	check from is_disabled.  We want to be able to distinguish
	the two.



Modified:
   trunk/ChangeLog
   trunk/gnome-session/gsm-app.c
   trunk/gnome-session/gsm-app.h
   trunk/gnome-session/gsm-autostart-app.c
   trunk/gnome-session/gsm-manager.c

Modified: trunk/gnome-session/gsm-app.c
==============================================================================
--- trunk/gnome-session/gsm-app.c	(original)
+++ trunk/gnome-session/gsm-app.c	Tue Aug  5 02:20:14 2008
@@ -349,6 +349,18 @@
 }
 
 gboolean
+gsm_app_peek_is_conditionally_disabled (GsmApp *app)
+{
+        g_return_val_if_fail (GSM_IS_APP (app), FALSE);
+
+        if (GSM_APP_GET_CLASS (app)->impl_is_conditionally_disabled) {
+                return GSM_APP_GET_CLASS (app)->impl_is_conditionally_disabled (app);
+        } else {
+                return FALSE;
+        }
+}
+
+gboolean
 gsm_app_is_running (GsmApp *app)
 {
         g_return_val_if_fail (GSM_IS_APP (app), FALSE);

Modified: trunk/gnome-session/gsm-app.h
==============================================================================
--- trunk/gnome-session/gsm-app.h	(original)
+++ trunk/gnome-session/gsm-app.h	Tue Aug  5 02:20:14 2008
@@ -59,23 +59,24 @@
         void        (*registered)   (GsmApp *app);
 
         /* virtual methods */
-        gboolean    (*impl_start)                   (GsmApp     *app,
-                                                     GError    **error);
-        gboolean    (*impl_restart)                 (GsmApp     *app,
-                                                     GError    **error);
-        gboolean    (*impl_stop)                    (GsmApp     *app,
-                                                     GError    **error);
-        gboolean    (*impl_provides)                (GsmApp     *app,
-                                                     const char *service);
-        gboolean    (*impl_has_autostart_condition) (GsmApp     *app,
-                                                     const char *service);
-        gboolean    (*impl_is_running)              (GsmApp     *app);
-
-        gboolean    (*impl_get_autorestart)         (GsmApp     *app);
-        const char *(*impl_get_app_id)              (GsmApp     *app);
-        gboolean    (*impl_is_disabled)             (GsmApp     *app);
-        void        (*impl_set_client)              (GsmApp     *app,
-                                                     GsmClient  *client);
+        gboolean    (*impl_start)                     (GsmApp     *app,
+                                                       GError    **error);
+        gboolean    (*impl_restart)                   (GsmApp     *app,
+                                                       GError    **error);
+        gboolean    (*impl_stop)                      (GsmApp     *app,
+                                                       GError    **error);
+        gboolean    (*impl_provides)                  (GsmApp     *app,
+                                                       const char *service);
+        gboolean    (*impl_has_autostart_condition)   (GsmApp     *app,
+                                                       const char *service);
+        gboolean    (*impl_is_running)                (GsmApp     *app);
+
+        gboolean    (*impl_get_autorestart)           (GsmApp     *app);
+        const char *(*impl_get_app_id)                (GsmApp     *app);
+        gboolean    (*impl_is_disabled)               (GsmApp     *app);
+        gboolean    (*impl_is_conditionally_disabled) (GsmApp     *app);
+        void        (*impl_set_client)                (GsmApp     *app,
+                                                       GsmClient  *client);
 };
 
 typedef enum
@@ -87,44 +88,45 @@
 
 #define GSM_APP_ERROR gsm_app_error_quark ()
 
-GQuark           gsm_app_error_quark             (void);
-GType            gsm_app_get_type                (void) G_GNUC_CONST;
+GQuark           gsm_app_error_quark                    (void);
+GType            gsm_app_get_type                       (void) G_GNUC_CONST;
 
-gboolean         gsm_app_peek_autorestart        (GsmApp     *app);
+gboolean         gsm_app_peek_autorestart               (GsmApp     *app);
 
-const char      *gsm_app_peek_id                 (GsmApp     *app);
-const char      *gsm_app_peek_app_id             (GsmApp     *app);
-const char      *gsm_app_peek_startup_id         (GsmApp     *app);
-GsmManagerPhase  gsm_app_peek_phase              (GsmApp     *app);
-gboolean         gsm_app_peek_is_disabled        (GsmApp     *app);
-
-gboolean         gsm_app_start                   (GsmApp     *app,
-                                                  GError    **error);
-gboolean         gsm_app_restart                 (GsmApp     *app,
-                                                  GError    **error);
-gboolean         gsm_app_stop                    (GsmApp     *app,
-                                                  GError    **error);
-gboolean         gsm_app_is_running              (GsmApp     *app);
-
-void             gsm_app_exited                  (GsmApp     *app);
-void             gsm_app_died                    (GsmApp     *app);
-
-gboolean         gsm_app_provides                (GsmApp     *app,
-                                                  const char *service);
-gboolean         gsm_app_has_autostart_condition (GsmApp     *app,
-                                                  const char *condition);
-void             gsm_app_registered              (GsmApp     *app);
+const char      *gsm_app_peek_id                        (GsmApp     *app);
+const char      *gsm_app_peek_app_id                    (GsmApp     *app);
+const char      *gsm_app_peek_startup_id                (GsmApp     *app);
+GsmManagerPhase  gsm_app_peek_phase                     (GsmApp     *app);
+gboolean         gsm_app_peek_is_disabled               (GsmApp     *app);
+gboolean         gsm_app_peek_is_conditionally_disabled (GsmApp     *app);
+
+gboolean         gsm_app_start                          (GsmApp     *app,
+                                                         GError    **error);
+gboolean         gsm_app_restart                        (GsmApp     *app,
+                                                         GError    **error);
+gboolean         gsm_app_stop                           (GsmApp     *app,
+                                                         GError    **error);
+gboolean         gsm_app_is_running                     (GsmApp     *app);
+
+void             gsm_app_exited                         (GsmApp     *app);
+void             gsm_app_died                           (GsmApp     *app);
+
+gboolean         gsm_app_provides                       (GsmApp     *app,
+                                                         const char *service);
+gboolean         gsm_app_has_autostart_condition        (GsmApp     *app,
+                                                         const char *condition);
+void             gsm_app_registered                     (GsmApp     *app);
 
 /* exported to bus */
-gboolean         gsm_app_get_app_id              (GsmApp     *app,
-                                                  char      **id,
-                                                  GError    **error);
-gboolean         gsm_app_get_startup_id          (GsmApp     *app,
-                                                  char      **id,
-                                                  GError    **error);
-gboolean         gsm_app_get_phase               (GsmApp     *app,
-                                                  guint      *phase,
-                                                  GError    **error);
+gboolean         gsm_app_get_app_id                     (GsmApp     *app,
+                                                         char      **id,
+                                                         GError    **error);
+gboolean         gsm_app_get_startup_id                 (GsmApp     *app,
+                                                         char      **id,
+                                                         GError    **error);
+gboolean         gsm_app_get_phase                      (GsmApp     *app,
+                                                         guint      *phase,
+                                                         GError    **error);
 
 G_END_DECLS
 

Modified: trunk/gnome-session/gsm-autostart-app.c
==============================================================================
--- trunk/gnome-session/gsm-autostart-app.c	(original)
+++ trunk/gnome-session/gsm-autostart-app.c	Tue Aug  5 02:20:14 2008
@@ -19,9 +19,7 @@
  * 02111-1307, USA.
  */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include <ctype.h>
 #include <string.h>
@@ -375,7 +373,7 @@
 }
 
 static gboolean
-is_disabled (GsmApp *app)
+is_conditionally_disabled (GsmApp *app)
 {
         GsmAutostartAppPrivate *priv;
         gboolean                autorestart = FALSE;
@@ -389,31 +387,6 @@
                                                             NULL);
         }
 
-        /* X-GNOME-Autostart-enabled key, used by old gnome-session */
-        if (egg_desktop_file_has_key (priv->desktop_file,
-                                      "X-GNOME-Autostart-enabled", NULL) &&
-            !egg_desktop_file_get_boolean (priv->desktop_file,
-                                           "X-GNOME-Autostart-enabled", NULL)) {
-                g_debug ("app %s is disabled by X-GNOME-Autostart-enabled",
-                         gsm_app_peek_id (app));
-                return TRUE;
-        }
-
-        /* Hidden key, used by autostart spec */
-        if (egg_desktop_file_get_boolean (priv->desktop_file,
-                                          EGG_DESKTOP_FILE_KEY_HIDDEN, NULL)) {
-                g_debug ("app %s is disabled by Hidden",
-                         gsm_app_peek_id (app));
-                return TRUE;
-        }
-
-        /* Check OnlyShowIn/NotShowIn/TryExec */
-        if (!egg_desktop_file_can_launch (priv->desktop_file, "GNOME")) {
-                g_debug ("app %s not installed or not for GNOME",
-                         gsm_app_peek_id (app));
-                return TRUE;
-        }
-
         /* Check AutostartCondition */
         g_free (priv->condition_string);
         priv->condition_string = egg_desktop_file_get_string (priv->desktop_file,
@@ -519,6 +492,52 @@
         return FALSE;
 }
 
+static gboolean
+is_disabled (GsmApp *app)
+{
+        GsmAutostartAppPrivate *priv;
+        gboolean                autorestart = FALSE;
+
+        priv = GSM_AUTOSTART_APP (app)->priv;
+
+        if (egg_desktop_file_has_key (priv->desktop_file,
+                                      "X-GNOME-AutoRestart", NULL)) {
+                autorestart = egg_desktop_file_get_boolean (priv->desktop_file,
+                                                            "X-GNOME-AutoRestart",
+                                                            NULL);
+        }
+
+        /* X-GNOME-Autostart-enabled key, used by old gnome-session */
+        if (egg_desktop_file_has_key (priv->desktop_file,
+                                      "X-GNOME-Autostart-enabled", NULL) &&
+            !egg_desktop_file_get_boolean (priv->desktop_file,
+                                           "X-GNOME-Autostart-enabled", NULL)) {
+                g_debug ("app %s is disabled by X-GNOME-Autostart-enabled",
+                         gsm_app_peek_id (app));
+                return TRUE;
+        }
+
+        /* Hidden key, used by autostart spec */
+        if (egg_desktop_file_get_boolean (priv->desktop_file,
+                                          EGG_DESKTOP_FILE_KEY_HIDDEN, NULL)) {
+                g_debug ("app %s is disabled by Hidden",
+                         gsm_app_peek_id (app));
+                return TRUE;
+        }
+
+        /* Check OnlyShowIn/NotShowIn/TryExec */
+        if (!egg_desktop_file_can_launch (priv->desktop_file, "GNOME")) {
+                g_debug ("app %s not installed or not for GNOME",
+                         gsm_app_peek_id (app));
+                return TRUE;
+        }
+
+        /* Do not check AutostartCondition - this method is only to determine
+         if the app is unconditionally disabled */
+
+        return FALSE;
+}
+
 static void
 app_exited (GPid             pid,
             int              status,
@@ -897,6 +916,7 @@
         object_class->constructor = gsm_autostart_app_constructor;
 
         app_class->impl_is_disabled = is_disabled;
+        app_class->impl_is_conditionally_disabled = is_conditionally_disabled;
         app_class->impl_is_running = is_running;
         app_class->impl_start = gsm_autostart_app_start;
         app_class->impl_restart = gsm_autostart_app_restart;

Modified: trunk/gnome-session/gsm-manager.c
==============================================================================
--- trunk/gnome-session/gsm-manager.c	(original)
+++ trunk/gnome-session/gsm-manager.c	Tue Aug  5 02:20:14 2008
@@ -424,7 +424,8 @@
                           G_CALLBACK (app_condition_changed),
                           manager);
 
-        if (gsm_app_peek_is_disabled (app)) {
+        if (gsm_app_peek_is_disabled (app)
+            || gsm_app_peek_is_conditionally_disabled (app)) {
                 g_debug ("GsmManager: Skipping disabled app: %s", id);
                 goto out;
         }



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