diff options
author | Michael Fleming <mfleming@src.gnome.org> | 2000-10-24 02:46:16 +0000 |
---|---|---|
committer | Michael Fleming <mfleming@src.gnome.org> | 2000-10-24 02:46:16 +0000 |
commit | 2b3410dfc221d1c04f1f32a429b2c2ea20664df4 (patch) | |
tree | 4b01501520da4c612a29b45825872519b37b2343 /components | |
parent | 399bde65ff7b71fc1cd334356d3bb1730f9d86eb (diff) | |
download | nautilus-2b3410dfc221d1c04f1f32a429b2c2ea20664df4.tar.gz |
Add gconf-init
* components/services/summary/nautilus-view/main.c: (main):
Add gconf-init
* components/services/summary/nautilus-view/nautilus-summary-view.c
: (save_default_eazel_service_user), (authn_cb_succeeded),
(am_i_logged_in), (logged_in_callback),
(nautilus_summary_view_initialize),
(nautilus_summary_view_destroy):
Store previously used Eazel Service user for later. The ammonite
login dialog makes use of this as the default username.
Diffstat (limited to 'components')
4 files changed, 66 insertions, 6 deletions
diff --git a/components/services/summary/main.c b/components/services/summary/main.c index 4d8dc3842..12ade12e7 100644 --- a/components/services/summary/main.c +++ b/components/services/summary/main.c @@ -29,6 +29,7 @@ #include <liboaf/liboaf.h> #include <bonobo.h> #include "nautilus-summary-view.h" +#include <gconf/gconf.h> static int object_count =0; @@ -88,6 +89,7 @@ main (int argc, char *argv[]) bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL); + gconf_init (argc, argv, NULL); registration_id = oaf_make_registration_id ("OAFIID:nautilus_summary_view_factory:1b0b1018-e0ca-4f14-8d23-7a134486ab30", getenv ("DISPLAY")); diff --git a/components/services/summary/nautilus-summary-view.c b/components/services/summary/nautilus-summary-view.c index e4a61cb0f..4bc9950f6 100644 --- a/components/services/summary/nautilus-summary-view.c +++ b/components/services/summary/nautilus-summary-view.c @@ -49,6 +49,8 @@ #include <stdio.h> #include <unistd.h> +#include <gconf/gconf.h> + #include <orb/orbit.h> #include <liboaf/liboaf.h> #include <libtrilobite/trilobite-redirect.h> @@ -82,6 +84,8 @@ #define URL_REDIRECT_TABLE_HOME "http://localhost/redirects.xml" #endif +#define KEY_GCONF_TRILOBITE_DEFAULT_USER "/apps/eazel-trilobite/default-services-user" + typedef struct _ServicesButtonCallbackData ServicesButtonCallbackData; typedef enum { @@ -189,6 +193,9 @@ struct _NautilusSummaryViewDetails { EazelProxy_UserControl user_control; SummaryPendingOperationType pending_operation; EazelProxy_AuthnCallback authn_callback; + + /* GConf */ + GConfEngine * engine_gconf; }; static void nautilus_summary_view_initialize_class (NautilusSummaryViewClass *klass); @@ -793,6 +800,20 @@ generate_update_news_entry_row (NautilusSummaryView *view, int row) } static void +save_default_eazel_service_user (NautilusSummaryView *view, const EazelProxy_User *user) +{ + GConfValue *value; + + value = gconf_value_new (GCONF_VALUE_STRING); + + gconf_value_set_string (value, user->user_name); + + gconf_engine_set (view->details->engine_gconf, KEY_GCONF_TRILOBITE_DEFAULT_USER, value, NULL); + + gconf_value_free (value); +} + +static void authn_cb_succeeded (const EazelProxy_User *user, gpointer state, CORBA_Environment *ev) { NautilusSummaryView *view; @@ -807,6 +828,8 @@ authn_cb_succeeded (const EazelProxy_User *user, gpointer state, CORBA_Environme g_message ("Login succeeded"); timeout = gtk_timeout_add (0, logged_in_callback, view); + save_default_eazel_service_user (view, user); + bonobo_object_unref (BONOBO_OBJECT (view->details->nautilus_view)); } @@ -949,11 +972,11 @@ am_i_logged_in (NautilusSummaryView *view) view->details->user_control, &ev); if (CORBA_NO_EXCEPTION != ev._major) { - g_message ("No default user!"); + g_message ("No Eazel Service User is currently logged in"); rv = FALSE; } else { - g_message ("Default user found!"); + g_message ("Default Eazel Service User is '%s'", user->user_name); CORBA_free (user); rv = TRUE; } @@ -1001,6 +1024,7 @@ who_is_logged_in (NautilusSummaryView *view) return rv; } /* end who_is_logged_in */ + static gint logged_in_callback (gpointer raw) { @@ -1008,7 +1032,7 @@ logged_in_callback (gpointer raw) view = NAUTILUS_SUMMARY_VIEW (raw); view->details->logged_in = TRUE; - + update_menu_items (view, TRUE); go_to_uri (view->details->nautilus_view, "eazel:"); @@ -1273,6 +1297,8 @@ nautilus_summary_view_initialize (NautilusSummaryView *view) view->details->user_control = (EazelProxy_UserControl) oaf_activate_from_id (IID_EAZELPROXY, 0, NULL, &ev); + view->details->engine_gconf = gconf_engine_get_default(); + if ( CORBA_NO_EXCEPTION != ev._major ) { /* FIXME bugzilla.eazel.com 2740: user should be warned that Ammonite may not be installed */ g_warning ("Couldn't instantiate eazel-proxy\n"); @@ -1315,6 +1341,8 @@ nautilus_summary_view_destroy (GtkObject *object) g_assert (Pending_None == view->details->pending_operation); CORBA_Object_release (view->details->user_control, &ev); + gconf_engine_unref (view->details->engine_gconf); + g_free (view->details); NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object)); diff --git a/components/services/summary/nautilus-view/main.c b/components/services/summary/nautilus-view/main.c index 4d8dc3842..12ade12e7 100644 --- a/components/services/summary/nautilus-view/main.c +++ b/components/services/summary/nautilus-view/main.c @@ -29,6 +29,7 @@ #include <liboaf/liboaf.h> #include <bonobo.h> #include "nautilus-summary-view.h" +#include <gconf/gconf.h> static int object_count =0; @@ -88,6 +89,7 @@ main (int argc, char *argv[]) bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL); + gconf_init (argc, argv, NULL); registration_id = oaf_make_registration_id ("OAFIID:nautilus_summary_view_factory:1b0b1018-e0ca-4f14-8d23-7a134486ab30", getenv ("DISPLAY")); diff --git a/components/services/summary/nautilus-view/nautilus-summary-view.c b/components/services/summary/nautilus-view/nautilus-summary-view.c index e4a61cb0f..4bc9950f6 100644 --- a/components/services/summary/nautilus-view/nautilus-summary-view.c +++ b/components/services/summary/nautilus-view/nautilus-summary-view.c @@ -49,6 +49,8 @@ #include <stdio.h> #include <unistd.h> +#include <gconf/gconf.h> + #include <orb/orbit.h> #include <liboaf/liboaf.h> #include <libtrilobite/trilobite-redirect.h> @@ -82,6 +84,8 @@ #define URL_REDIRECT_TABLE_HOME "http://localhost/redirects.xml" #endif +#define KEY_GCONF_TRILOBITE_DEFAULT_USER "/apps/eazel-trilobite/default-services-user" + typedef struct _ServicesButtonCallbackData ServicesButtonCallbackData; typedef enum { @@ -189,6 +193,9 @@ struct _NautilusSummaryViewDetails { EazelProxy_UserControl user_control; SummaryPendingOperationType pending_operation; EazelProxy_AuthnCallback authn_callback; + + /* GConf */ + GConfEngine * engine_gconf; }; static void nautilus_summary_view_initialize_class (NautilusSummaryViewClass *klass); @@ -793,6 +800,20 @@ generate_update_news_entry_row (NautilusSummaryView *view, int row) } static void +save_default_eazel_service_user (NautilusSummaryView *view, const EazelProxy_User *user) +{ + GConfValue *value; + + value = gconf_value_new (GCONF_VALUE_STRING); + + gconf_value_set_string (value, user->user_name); + + gconf_engine_set (view->details->engine_gconf, KEY_GCONF_TRILOBITE_DEFAULT_USER, value, NULL); + + gconf_value_free (value); +} + +static void authn_cb_succeeded (const EazelProxy_User *user, gpointer state, CORBA_Environment *ev) { NautilusSummaryView *view; @@ -807,6 +828,8 @@ authn_cb_succeeded (const EazelProxy_User *user, gpointer state, CORBA_Environme g_message ("Login succeeded"); timeout = gtk_timeout_add (0, logged_in_callback, view); + save_default_eazel_service_user (view, user); + bonobo_object_unref (BONOBO_OBJECT (view->details->nautilus_view)); } @@ -949,11 +972,11 @@ am_i_logged_in (NautilusSummaryView *view) view->details->user_control, &ev); if (CORBA_NO_EXCEPTION != ev._major) { - g_message ("No default user!"); + g_message ("No Eazel Service User is currently logged in"); rv = FALSE; } else { - g_message ("Default user found!"); + g_message ("Default Eazel Service User is '%s'", user->user_name); CORBA_free (user); rv = TRUE; } @@ -1001,6 +1024,7 @@ who_is_logged_in (NautilusSummaryView *view) return rv; } /* end who_is_logged_in */ + static gint logged_in_callback (gpointer raw) { @@ -1008,7 +1032,7 @@ logged_in_callback (gpointer raw) view = NAUTILUS_SUMMARY_VIEW (raw); view->details->logged_in = TRUE; - + update_menu_items (view, TRUE); go_to_uri (view->details->nautilus_view, "eazel:"); @@ -1273,6 +1297,8 @@ nautilus_summary_view_initialize (NautilusSummaryView *view) view->details->user_control = (EazelProxy_UserControl) oaf_activate_from_id (IID_EAZELPROXY, 0, NULL, &ev); + view->details->engine_gconf = gconf_engine_get_default(); + if ( CORBA_NO_EXCEPTION != ev._major ) { /* FIXME bugzilla.eazel.com 2740: user should be warned that Ammonite may not be installed */ g_warning ("Couldn't instantiate eazel-proxy\n"); @@ -1315,6 +1341,8 @@ nautilus_summary_view_destroy (GtkObject *object) g_assert (Pending_None == view->details->pending_operation); CORBA_Object_release (view->details->user_control, &ev); + gconf_engine_unref (view->details->engine_gconf); + g_free (view->details); NAUTILUS_CALL_PARENT_CLASS (GTK_OBJECT_CLASS, destroy, (object)); |