Re: Session management?



Do you sync the preference file?

If you do not then all changes will never be written


>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 6/30/00, 12:31:00 PM, Jorgen Pehrson <jp@spektr.eu.org> wrote regarding 
Session management?:


> Hi,
> I have a problem with session management in Gnome. I create my applet in
> the main() loop. And this is where I want to load my settings. But the
> applet will not use the same session preferences file the next time I
> start the applet. Some of my code:

> main():
> ..
>   applet_widget_init(PACKAGE, VERSION, argc, argv, NULL, 0, NULL);
>   battstat->applet = applet_widget_new(PACKAGE);
>   gnome_config_push_prefix 
(APPLET_WIDGET(battstat->applet)->privcfgpath);
>   g_print("Path load %s\n", 
APPLET_WIDGET(battstat->applet)->privcfgpath);
>   battstat->red_val = gnome_config_get_int ("batt/red_val=15");
>   gnome_config_pop_prefix ();

>   gtk_signal_connect (GTK_OBJECT(battstat->applet),"save_session",
>                     GTK_SIGNAL_FUNC(applet_save_session),
>                     battstat);

> static gint
> applet_save_session(GtkWidget *w, char *privcfgpath, char *globcfgpath,
>                   gpointer data)
> {
>   ProgressData *battstat = data;

>   gnome_config_push_prefix (privcfgpath);
>   gnome_config_set_int ("batt/red_val", battstat->red_val);
>   g_print("Path2 save: 
%s\n",APPLET_WIDGET(battstat->applet)->privcfgpath);
>   g_print("Path3: save %s\n", privcfgpath);
>   g_print("Red: %d\n", battstat->red_val);
>   gnome_config_pop_prefix ();

>   gnome_config_sync();
>   gnome_config_drop_all ();

>   return FALSE;
>   w = NULL;
> }

> And when I run the applet my g_print()s print this:
> % ./battstat_applet

> Gdk-WARNING **: locale not supported by C library
> Path load: /panel.d/default/Applet_Dummy/
> Path2 save: /panel.d/default/Applet_Dummy/
> Path3: save /panel.d/default/Applet_209_Extern/
> Red: 15


> And if I quit the applet and start it again the "Path3 save" will display
> something else. Which means that my previous settings will not be loaded.

> I've downloaded the gnome-applets-1.1.90 and put in some g_prints in the
> corresponding places and they exhibit the exact same behavior. (For
> example, the gnotes & diskusage applets are not working. They will at
> least get a new /panel.d/default/Applet_???_Extern/ name every time.)

> Is something wrong with my GNOME installation? What could it be?


> Thanks!

> --
> Jörgen Pehrson  jp@spektr.eu.org  http://spektr.eu.org/~jp/
> -----------------------------------------------------------
> "i must say the linux community is a lot nicer than the unix
> community. a negative comment on unix would warrent death
> threats. with linux, it is like stirring up a nest of butterflies."
>              -- Ken Thompson. 1999




> _______________________________________________
> gnome-devel-list mailing list
> gnome-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gnome-devel-list




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