[gnome-session] session: Remove RequiredProviders support



commit 098fad4ea1be6953f66fc457df1943a31247611a
Author: Bastien Nocera <hadess hadess net>
Date:   Sun Jan 13 18:30:25 2013 +0100

    session: Remove RequiredProviders support
    
    This is only needed when we have interchangeable system components
    to handle particular features, such as using a specific notification
    daemon. We don't need that any more, as those should be provided by
    RequiredComponents already, and not changeable.
    
    If a non-GNOME desktop uses gnome-session, they will most likely have
    their preferred provider for that feature.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=691663

 doc/man/gnome-session.1          |   12 +---
 gnome-session/gsm-session-fill.c |  139 +-------------------------------------
 2 files changed, 5 insertions(+), 146 deletions(-)
---
diff --git a/doc/man/gnome-session.1 b/doc/man/gnome-session.1
index 80b7674..35c062c 100644
--- a/doc/man/gnome-session.1
+++ b/doc/man/gnome-session.1
@@ -57,22 +57,14 @@ Name of the session. This can be localized.
 .TP
 .I RequiredComponents
 List of component identifiers (desktop files) that are required by the session. The required components will always run in the session.
-.TP
-.I RequiredProviders
-List of task providers that are required by the session. A default provider for each task has to be defined with a \fIDefaultProvider-TASK\fP key; the provider can be overridden by required components, the saved session or autostart applications. The task providers will always run in the session.
-.TP
-.I DefaultProvider-TASK
-Identifier (desktop file) of the default provider for \fBTASK\fP. If no provider for \fBTASK\fP is found in the required components, the saved session and in the autostart applications, the default provider will be started.
 .PP
 Here is an example of a session definition:
 .PP
 .in +4n
 .nf
 [GNOME Session]
-Name=GNOME fallback
-RequiredComponents=gnome-panel;metacity;gnome-settings-daemon;
-RequiredProviders=notifications;
-DefaultProvider-notifications=notification-daemon
+Name=GNOME
+RequiredComponents=gnome-shell;gnome-settings-daemon;
 .in
 .fi
 .PP
diff --git a/gnome-session/gsm-session-fill.c b/gnome-session/gsm-session-fill.c
index a5ef5ef..d1419f5 100644
--- a/gnome-session/gsm-session-fill.c
+++ b/gnome-session/gsm-session-fill.c
@@ -32,76 +32,15 @@
 #define GSM_KEYFILE_RUNNABLE_KEY "IsRunnableHelper"
 #define GSM_KEYFILE_FALLBACK_KEY "FallbackSession"
 #define GSM_KEYFILE_REQUIRED_COMPONENTS_KEY "RequiredComponents"
-#define GSM_KEYFILE_REQUIRED_PROVIDERS_KEY  "RequiredProviders"
-#define GSM_KEYFILE_DEFAULT_PROVIDER_PREFIX "DefaultProvider"
 
 /* See https://bugzilla.gnome.org/show_bug.cgi?id=641992 for discussion */
 #define GSM_RUNNABLE_HELPER_TIMEOUT 3000 /* ms */
 
-typedef void (*GsmFillHandleProvider) (const char *provides,
-                                       const char *default_provider,
-                                       const char *app_path,
-                                       gpointer    user_data);
 typedef void (*GsmFillHandleComponent) (const char *component,
                                         const char *app_path,
                                         gpointer    user_data);
 
 static void
-handle_default_providers (GKeyFile              *keyfile,
-                          gboolean               look_in_saved_session,
-                          GsmFillHandleProvider  callback,
-                          gpointer               user_data)
-{
-        char **default_providers;
-        int    i;
-
-        g_assert (keyfile != NULL);
-        g_assert (callback != NULL);
-
-        default_providers = g_key_file_get_string_list (keyfile,
-                                                        GSM_KEYFILE_SESSION_GROUP,
-                                                        GSM_KEYFILE_REQUIRED_PROVIDERS_KEY,
-                                                        NULL, NULL);
-
-        if (!default_providers)
-                return;
-
-        for (i = 0; default_providers[i] != NULL; i++) {
-                char *key;
-                char *value;
-                char *app_path;
-
-                if (IS_STRING_EMPTY (default_providers[i]))
-                        continue;
-
-                key = g_strdup_printf ("%s-%s",
-                                       GSM_KEYFILE_DEFAULT_PROVIDER_PREFIX,
-                                       default_providers[i]);
-                value = g_key_file_get_string (keyfile,
-                                               GSM_KEYFILE_SESSION_GROUP, key,
-                                               NULL);
-                g_free (key);
-
-                if (IS_STRING_EMPTY (value)) {
-                        g_free (value);
-                        continue;
-                }
-
-                g_debug ("fill: provider '%s' looking for component: '%s'",
-                         default_providers[i], value);
-                app_path = gsm_util_find_desktop_file_for_app_name (value,
-                                                                    look_in_saved_session, TRUE);
-
-                callback (default_providers[i], value, app_path, user_data);
-                g_free (app_path);
-
-                g_free (value);
-        }
-
-        g_strfreev (default_providers);
-}
-
-static void
 handle_required_components (GKeyFile               *keyfile,
                             gboolean                look_in_saved_session,
                             GsmFillHandleComponent  callback,
@@ -134,21 +73,6 @@ handle_required_components (GKeyFile               *keyfile,
 }
 
 static void
-check_required_providers_helper (const char *provides,
-                                 const char *default_provider,
-                                 const char *app_path,
-                                 gpointer    user_data)
-{
-        gboolean *error = user_data;
-
-        if (app_path == NULL) {
-                g_warning ("Unable to find default provider '%s' of required provider '%s'",
-                           default_provider, provides);
-                *error = TRUE;
-        }
-}
-
-static void
 check_required_components_helper (const char *component,
                                   const char *app_path,
                                   gpointer    user_data)
@@ -166,14 +90,12 @@ check_required (GKeyFile *keyfile)
 {
         gboolean error = FALSE;
 
-        g_debug ("fill: *** Checking required components and providers");
+        g_debug ("fill: *** Checking required components");
 
-        handle_default_providers (keyfile, FALSE,
-                                  check_required_providers_helper, &error);
         handle_required_components (keyfile, FALSE,
                                     check_required_components_helper, &error);
 
-        g_debug ("fill: *** Done checking required components and providers");
+        g_debug ("fill: *** Done checking required components");
 
         return !error;
 }
@@ -195,21 +117,6 @@ maybe_load_saved_session_apps (GsmManager *manager)
 }
 
 static void
-append_required_providers_helper (const char *provides,
-                                  const char *default_provider,
-                                  const char *app_path,
-                                  gpointer    user_data)
-{
-        GsmManager *manager = user_data;
-
-        if (app_path == NULL)
-                g_warning ("Unable to find default provider '%s' of required provider '%s'",
-                           default_provider, provides);
-        else
-                gsm_manager_add_required_app (manager, app_path, provides);
-}
-
-static void
 append_required_components_helper (const char *component,
                                    const char *app_path,
                                    gpointer    user_data)
@@ -247,11 +154,6 @@ load_standard_apps (GsmManager *manager,
 
                 g_strfreev (autostart_dirs);
         }
-
-        g_debug ("fill: *** Adding default providers");
-        handle_default_providers (keyfile, !gsm_manager_get_failsafe (manager),
-                                  append_required_providers_helper, manager);
-        g_debug ("fill: *** Done adding default providers");
 }
 
 static GKeyFile *
@@ -275,42 +177,7 @@ get_session_keyfile_if_valid (const char *path)
                 goto error;
         }
 
-        /* check that we have default providers defined for required providers */
-        list = g_key_file_get_string_list (keyfile,
-                                           GSM_KEYFILE_SESSION_GROUP,
-                                           GSM_KEYFILE_REQUIRED_PROVIDERS_KEY,
-                                           &len, NULL);
-        if (list != NULL) {
-                int i;
-                char *key;
-                char *value;
-
-                for (i = 0; list[i] != NULL; i++) {
-                        key = g_strdup_printf ("%s-%s", GSM_KEYFILE_DEFAULT_PROVIDER_PREFIX, list[i]);
-                        value = g_key_file_get_string (keyfile,
-                                                       GSM_KEYFILE_SESSION_GROUP, key,
-                                                       NULL);
-                        g_free (key);
-
-                        if (IS_STRING_EMPTY (value)) {
-                                g_free (value);
-                                break;
-                        }
-
-                        g_free (value);
-                }
-
-                if (list[i] != NULL) {
-                        g_warning ("Cannot use session '%s': required provider '%s' is not defined.", path, list[i]);
-                        g_strfreev (list);
-                        goto error;
-                }
-
-                g_strfreev (list);
-        }
-
-        /* we don't want an empty session, so if there's no required provider, check
-         * that we do have some required components */
+        /* check that we do have some required components */
         if (len == 0) {
                 list = g_key_file_get_string_list (keyfile,
                                                    GSM_KEYFILE_SESSION_GROUP,



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