diff options
Diffstat (limited to 'xfce4-session')
-rw-r--r-- | xfce4-session/Makefile.am | 6 | ||||
-rw-r--r-- | xfce4-session/main.c | 49 | ||||
-rw-r--r-- | xfce4-session/shutdown.c | 21 | ||||
-rw-r--r-- | xfce4-session/sm-layer.c | 8 | ||||
-rw-r--r-- | xfce4-session/sm-layer.h | 7 | ||||
-rw-r--r-- | xfce4-session/xfsm-manager.c | 86 | ||||
-rw-r--r-- | xfce4-session/xfsm-manager.h | 11 | ||||
-rw-r--r-- | xfce4-session/xfsm-startup.c | 2 | ||||
-rw-r--r-- | xfce4-session/xfsm-startup.h | 3 |
9 files changed, 102 insertions, 91 deletions
diff --git a/xfce4-session/Makefile.am b/xfce4-session/Makefile.am index de5ddbe1..e4110d3d 100644 --- a/xfce4-session/Makefile.am +++ b/xfce4-session/Makefile.am @@ -59,6 +59,7 @@ xfce4_session_CFLAGS = \ $(DBUS_CFLAGS) \ $(DBUS_GLIB_CFLAGS) \ $(LIBWNCK_CFLAGS) \ + $(XFCONF_CFLAGS) \ -DDBUS_API_SUBJECT_TO_CHANGE \ -DWNCK_I_KNOW_THIS_IS_UNSTABLE \ -DLIBDIR=\"$(libdir)\" \ @@ -67,7 +68,7 @@ xfce4_session_CFLAGS = \ -DXFSM_SHUTDOWN_HELPER=\"$(libexecdir)/xfsm-shutdown-helper\" xfce4_session_LDADD = \ - $(top_builddir)/libxfsm/libxfsm-4.2.la \ + $(top_builddir)/libxfsm/libxfsm-4.6.la \ $(LIBSM_LDFLAGS) \ $(LIBSM_LIBS) \ $(LIBX11_LDFLAGS) \ @@ -76,11 +77,12 @@ xfce4_session_LDADD = \ $(DBUS_LIBS) \ $(DBUS_GLIB_LIBS) \ $(LIBWNCK_LIBS) \ + $(XFCONF_LIBS) \ $(GNOME_LIBS) \ $(GNOME_KEYRING_LIBS) xfce4_session_DEPENDENCIES = \ - $(top_builddir)/libxfsm/libxfsm-4.2.la + $(top_builddir)/libxfsm/libxfsm-4.6.la chooser-icon.h: $(srcdir)/chooser-icon.png diff --git a/xfce4-session/main.c b/xfce4-session/main.c index f5d01ff1..a2f5cbf2 100644 --- a/xfce4-session/main.c +++ b/xfce4-session/main.c @@ -49,10 +49,13 @@ #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-lowlevel.h> +#include <xfconf/xfconf.h> + #include <gdk/gdkx.h> #include <gtk/gtk.h> #include <libxfce4util/libxfce4util.h> +#include <libxfcegui4/libxfcegui4.h> #include <libxfsm/xfsm-util.h> @@ -129,23 +132,21 @@ usage (int exit_code) static void -init_display (XfsmManager *manager, - GdkDisplay *dpy, - XfceRc *rc, - gboolean disable_tcp) +init_display (XfsmManager *manager, + GdkDisplay *dpy, + XfconfChannel *channel, + gboolean disable_tcp) { const gchar *engine; - xfce_rc_set_group (rc, "Splash Screen"); - engine = xfce_rc_read_entry (rc, "Engine", NULL); + engine = xfconf_channel_get_string (channel, "/splash/Engine", "mice"); splash_screen = xfsm_splash_screen_new (dpy, engine); xfsm_splash_screen_next (splash_screen, _("Loading desktop settings")); gdk_flush (); - xfce_rc_set_group (rc, "General"); - sm_init (rc, disable_tcp, manager); + sm_init (channel, disable_tcp, manager); /* start xfsettingsd */ if ( !g_spawn_command_line_async ("xfsettingsd", NULL)) @@ -166,7 +167,7 @@ initialize (XfsmManager *manager, { gboolean disable_tcp = FALSE; GdkDisplay *dpy; - XfceRc *rc; + XfconfChannel *channel; for (++argv; --argc > 0; ++argv) { @@ -196,10 +197,10 @@ initialize (XfsmManager *manager, setup_environment (); - rc = xfsm_open_config (TRUE); + channel = xfsm_open_config (); dpy = gdk_display_get_default (); - init_display (manager, dpy, rc, disable_tcp); + init_display (manager, dpy, channel, disable_tcp); /* verify that the DNS settings are ok */ xfsm_splash_screen_next (splash_screen, _("Verifying DNS settings")); @@ -207,19 +208,8 @@ initialize (XfsmManager *manager, xfsm_splash_screen_next (splash_screen, _("Loading session data")); - xfce_rc_set_group (rc, "General"); - xfsm_startup_init (rc); - xfsm_manager_load (manager, rc); - - /* cleanup obsolete entries */ - xfce_rc_set_group (rc, "General"); - if (xfce_rc_has_entry (rc, "ConfirmLogout")) - xfce_rc_delete_entry (rc, "ConfirmLogout", FALSE); - if (xfce_rc_has_entry (rc, "AlwaysDisplayChooser")) - xfce_rc_delete_entry (rc, "AlwaysDisplayChooser", FALSE); - xfce_rc_delete_group (rc, "Splash Theme", FALSE); - - xfce_rc_close (rc); + xfsm_startup_init (channel); + xfsm_manager_load (manager, channel); } @@ -272,6 +262,7 @@ main (int argc, char **argv) { XfsmManager *manager; XfsmShutdownType shutdown_type; + GError *error = NULL; xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8"); @@ -280,6 +271,16 @@ main (int argc, char **argv) gtk_init (&argc, &argv); + if (G_UNLIKELY (!xfconf_init (&error))) { + xfce_message_dialog (NULL, _("Xfce Session Manager"), + GTK_STOCK_DIALOG_ERROR, + _("Unable to contact settings server"), + error->message, + GTK_STOCK_CLOSE, GTK_RESPONSE_ACCEPT, + NULL); + g_error_free (error); + } + /* fake a client id for the manager, so the legacy management does not * recognize us to be a session client. */ diff --git a/xfce4-session/shutdown.c b/xfce4-session/shutdown.c index 07725513..59b9908b 100644 --- a/xfce4-session/shutdown.c +++ b/xfce4-session/shutdown.c @@ -170,7 +170,7 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea gint result; XfceKiosk *kiosk; gboolean kiosk_can_shutdown; - XfceRc *rc; + XfconfChannel *channel; #ifdef SESSION_SCREENSHOTS GdkRectangle screenshot_area; GdkWindow *root; @@ -194,17 +194,15 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea xfce_kiosk_free (kiosk); /* load configuration */ - rc = xfsm_open_config (FALSE); - xfce_rc_set_group (rc, "General"); - saveonexit = xfce_rc_read_bool_entry (rc, "SaveOnExit", TRUE); - autosave = xfce_rc_read_bool_entry (rc, "AutoSave", FALSE); - prompt = xfce_rc_read_bool_entry (rc, "PromptOnLogout", TRUE); + channel = xfsm_open_config (); + channel = xfconf_channel_get ("xfce4-session"); + saveonexit = xfconf_channel_get_bool (channel, "/general/SaveOnExit", TRUE); + autosave = xfconf_channel_get_bool (channel, "/general/AutoSave", FALSE); + prompt = xfconf_channel_get_bool (channel, "/general/PromptOnLogout", TRUE); /* if PromptOnLogout is off, saving depends on AutoSave */ if (!prompt) { - xfce_rc_close (rc); - *shutdownType = XFSM_SHUTDOWN_LOGOUT; *saveSession = autosave; @@ -552,9 +550,8 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea */ if (result == GTK_RESPONSE_OK) { - xfce_rc_set_group (rc, "General"); - xfce_rc_write_entry (rc, "SessionName", sessionName); - xfce_rc_write_bool_entry (rc, "SaveOnExit", *saveSession); + xfconf_channel_set_string (channel, "/general/SessionName", sessionName); + xfconf_channel_set_bool (channel, "/general/SaveOnExit", *saveSession); } else { @@ -572,8 +569,6 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea } #endif - xfce_rc_close (rc); - return (result == GTK_RESPONSE_OK); } diff --git a/xfce4-session/sm-layer.c b/xfce4-session/sm-layer.c index 3e909496..6677739b 100644 --- a/xfce4-session/sm-layer.c +++ b/xfce4-session/sm-layer.c @@ -98,14 +98,14 @@ static IceListenObj *listen_objs; void -sm_init (XfceRc *rc, - gboolean disable_tcp, - XfsmManager *manager) +sm_init (XfconfChannel *channel, + gboolean disable_tcp, + XfsmManager *manager) { char *network_idlist; char error[2048]; - if (disable_tcp || xfce_rc_read_bool_entry (rc, "DisableTcp", FALSE)) + if (disable_tcp || !xfconf_channel_get_bool (channel, "/security/EnableTcp", TRUE)) { #ifdef HAVE__ICETRANSNOLISTEN extern void _IceTransNoListen (char *protocol); diff --git a/xfce4-session/sm-layer.h b/xfce4-session/sm-layer.h index acfa8e8b..5769b9e7 100644 --- a/xfce4-session/sm-layer.h +++ b/xfce4-session/sm-layer.h @@ -22,12 +22,13 @@ #ifndef __SM_LAYER_H__ #define __SM_LAYER_H__ +#include <xfconf/xfconf.h> #include <libxfce4util/libxfce4util.h> #include "xfsm-manager.h" -void sm_init (XfceRc *rc, - gboolean disable_tcp, - XfsmManager *manager); +void sm_init (XfconfChannel *channel, + gboolean disable_tcp, + XfsmManager *manager); #endif /* !__SM_LAYER_H__ */ diff --git a/xfce4-session/xfsm-manager.c b/xfce4-session/xfsm-manager.c index 3ba56226..c03dd806 100644 --- a/xfce4-session/xfsm-manager.c +++ b/xfce4-session/xfsm-manager.c @@ -165,8 +165,8 @@ static void xfsm_manager_start_client_save_timeout (XfsmManager *manager, static void xfsm_manager_cancel_client_save_timeout (XfsmManager *manager, XfsmClient *client); static gboolean xfsm_manager_save_timeout (gpointer user_data); -static void xfsm_manager_load_settings (XfsmManager *manager, - XfceRc *rc); +static void xfsm_manager_load_settings (XfsmManager *manager, + XfconfChannel *channel); static gboolean xfsm_manager_load_session (XfsmManager *manager); static void xfsm_manager_dbus_class_init (XfsmManagerClass *klass); static void xfsm_manager_dbus_init (XfsmManager *manager); @@ -495,42 +495,56 @@ xfsm_manager_load_session (XfsmManager *manager) static gboolean -xfsm_manager_load_failsafe (XfsmManager *manager, - XfceRc *rc) +xfsm_manager_load_failsafe (XfsmManager *manager, + XfconfChannel *channel) { FailsafeClient *fclient; - const gchar *old_group; + gchar *failsafe_name; GdkDisplay *display; + gchar propbuf[4096]; gchar **command; gchar command_entry[256]; gchar screen_entry[256]; gint count; gint i; gint n_screen; - - if (!xfce_rc_has_group (rc, "Failsafe Session")) + + failsafe_name = xfconf_channel_get_string (channel, "/general/FailsafeSessionName", NULL); + if (G_UNLIKELY (!failsafe_name)) return FALSE; + g_snprintf (propbuf, sizeof (propbuf), "/sessions/%s/IsFailsafe", + failsafe_name); + if (!xfconf_channel_get_bool (channel, propbuf, FALSE)) + { + g_free (failsafe_name); + return FALSE; + } + display = gdk_display_get_default (); - old_group = xfce_rc_get_group (rc); - xfce_rc_set_group (rc, "Failsafe Session"); - - count = xfce_rc_read_int_entry (rc, "Count", 0); + + g_snprintf (propbuf, sizeof (propbuf), "/sessions/%s/Count", failsafe_name); + count = xfconf_channel_get_int (channel, propbuf, 0); for (i = 0; i < count; ++i) { - g_snprintf (command_entry, 256, "Client%d_Command", i); - command = xfce_rc_read_list_entry (rc, command_entry, NULL); + g_snprintf (command_entry, sizeof (command_entry), + "/sessions/%s/Client%d_Command", failsafe_name, i); + command = xfconf_channel_get_string_list (channel, command_entry); if (G_UNLIKELY (command == NULL)) continue; - g_snprintf (screen_entry, 256, "Client%d_PerScreen", i); - if (xfce_rc_read_bool_entry (rc, screen_entry, FALSE)) + g_snprintf (screen_entry, sizeof (screen_entry), + "/sessions/%s/Client%d_PerScreen", failsafe_name, i); + if (xfconf_channel_get_bool (channel, screen_entry, FALSE)) { for (n_screen = 0; n_screen < gdk_display_get_n_screens (display); ++n_screen) { fclient = g_new0 (FailsafeClient, 1); - fclient->command = xfce_rc_read_list_entry (rc, command_entry, NULL); + if (n_screen == 0) + fclient->command = command; + else + fclient->command = g_strdupv (command); fclient->screen = gdk_display_get_screen (display, n_screen); g_queue_push_tail (manager->failsafe_clients, fclient); } @@ -544,27 +558,26 @@ xfsm_manager_load_failsafe (XfsmManager *manager, } } - xfce_rc_set_group (rc, old_group); - return g_queue_peek_head (manager->failsafe_clients) != NULL; } static void -xfsm_manager_load_settings (XfsmManager *manager, - XfceRc *rc) +xfsm_manager_load_settings (XfsmManager *manager, + XfconfChannel *channel) { - gboolean session_loaded = FALSE; - const gchar *name; + gboolean session_loaded = FALSE; - name = xfce_rc_read_entry (rc, "SessionName", NULL); - if (name != NULL && *name != '\0') - manager->session_name = g_strdup (name); - else - manager->session_name = g_strdup (DEFAULT_SESSION_NAME); + manager->session_name = xfconf_channel_get_string (channel, + "/general/SessionName", + DEFAULT_SESSION_NAME); + if (G_UNLIKELY (manager->session_name[0] == '\0')) + { + g_free (manager->session_name); + manager->session_name = g_strdup (DEFAULT_SESSION_NAME); + } - xfce_rc_set_group (rc, "Chooser"); - manager->session_chooser = xfce_rc_read_bool_entry (rc, "AlwaysDisplay", FALSE); + manager->session_chooser = xfconf_channel_get_bool (channel, "/chooser/AlwaysDisplay", FALSE); session_loaded = xfsm_manager_load_session (manager); @@ -575,13 +588,12 @@ xfsm_manager_load_settings (XfsmManager *manager, } else { - if (!xfsm_manager_load_failsafe (manager, rc)) + if (!xfsm_manager_load_failsafe (manager, channel)) { fprintf (stderr, "xfce4-session: Unable to load failsafe session, exiting. Please check\n" " the value of the environment variable XDG_CONFIG_DIRS\n" " and make sure that it includes the following path:\n\n" " " SYSCONFDIR "/xdg\n\n"); - xfce_rc_close (rc); exit (EXIT_FAILURE); } manager->failsafe_mode = TRUE; @@ -590,8 +602,8 @@ xfsm_manager_load_settings (XfsmManager *manager, void -xfsm_manager_load (XfsmManager *manager, - XfceRc *rc) +xfsm_manager_load (XfsmManager *manager, + XfconfChannel *channel) { gchar *display_name; gchar *resource_name; @@ -599,11 +611,9 @@ xfsm_manager_load (XfsmManager *manager, gchar *s; #endif - xfce_rc_set_group (rc, "Compatibility"); - manager->compat_gnome = xfce_rc_read_bool_entry (rc, "LaunchGnome", FALSE); - manager->compat_kde = xfce_rc_read_bool_entry (rc, "LaunchKDE", FALSE); + manager->compat_gnome = xfconf_channel_get_bool (channel, "/compat/LaunchGNOME", FALSE); + manager->compat_kde = xfconf_channel_get_bool (channel, "/compat/LaunchKDE", FALSE); - xfce_rc_set_group (rc, "General"); display_name = xfce_gdk_display_get_fullname (gdk_display_get_default ()); #ifdef HAVE_OS_CYGWIN @@ -619,7 +629,7 @@ xfsm_manager_load (XfsmManager *manager, g_free (resource_name); g_free (display_name); - xfsm_manager_load_settings (manager, rc); + xfsm_manager_load_settings (manager, channel); } diff --git a/xfce4-session/xfsm-manager.h b/xfce4-session/xfsm-manager.h index 117e0f14..c41edc57 100644 --- a/xfce4-session/xfsm-manager.h +++ b/xfce4-session/xfsm-manager.h @@ -25,13 +25,14 @@ #include <glib-object.h> -G_BEGIN_DECLS - +#include <xfconf/xfconf.h> #include <libxfce4util/libxfce4util.h> -#include <xfce4-session/xfsm-client.h> +#include "xfsm-client.h" #include "shutdown.h" +G_BEGIN_DECLS + #define XFSM_TYPE_MANAGER (xfsm_manager_get_type()) #define XFSM_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XFSM_TYPE_MANAGER, XfsmManager)) #define XFSM_IS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), XFSM_TYPE_MANAGER)) @@ -70,8 +71,8 @@ GType xfsm_manager_get_type (void) G_GNUC_CONST; XfsmManager *xfsm_manager_new (void); -void xfsm_manager_load (XfsmManager *manager, - XfceRc *rc); +void xfsm_manager_load (XfsmManager *manager, + XfconfChannel *channel); gboolean xfsm_manager_restart (XfsmManager *manager); diff --git a/xfce4-session/xfsm-startup.c b/xfce4-session/xfsm-startup.c index a449fe2d..f2200d1e 100644 --- a/xfce4-session/xfsm-startup.c +++ b/xfce4-session/xfsm-startup.c @@ -91,7 +91,7 @@ static void xfsm_startup_handle_failed_client (XfsmProperties *properties XfsmManager *manager); void -xfsm_startup_init (XfceRc *rc) +xfsm_startup_init (XfconfChannel *channel) { /* nothing to be done here, currently */ } diff --git a/xfce4-session/xfsm-startup.h b/xfce4-session/xfsm-startup.h index 3593b495..48c54d05 100644 --- a/xfce4-session/xfsm-startup.h +++ b/xfce4-session/xfsm-startup.h @@ -23,9 +23,10 @@ #ifndef __XFSM_STARTUP_H__ #define __XFSM_STARTUP_H__ +#include <xfconf/xfconf.h> #include <libxfce4util/libxfce4util.h> -void xfsm_startup_init (XfceRc *rc); +void xfsm_startup_init (XfconfChannel *channel); void xfsm_startup_foreign (XfsmManager *manager); void xfsm_startup_begin (XfsmManager *manager); void xfsm_startup_session_continue (XfsmManager *manager); |