Commit 5924b4b0 authored by Jiri (George) Lebl's avatar Jiri (George) Lebl Committed by George Lebl

rightstick now works between sessions as well, and minor fixups (fixes bug

Wed Jun 10 22:26:31 1998  George Lebl  <jirka@5z.com>

        * panel-widget.[ch],panel.c: rightstick now works between sessions
          as well, and minor fixups (fixes bug #124)
parent 9ea251b2
Wed Jun 10 22:26:31 1998 George Lebl <jirka@5z.com>
* panel-widget.[ch],panel.c: rightstick now works between sessions
as well, and minor fixups (fixes bug #124)
Wed Jun 10 11:42:16 1998 Owen Taylor <otaylor@gtk.org>
* Makefile.am: Use MICO_LIBS variable from
......
Wed Jun 10 22:26:31 1998 George Lebl <jirka@5z.com>
* panel-widget.[ch],panel.c: rightstick now works between sessions
as well, and minor fixups (fixes bug #124)
Wed Jun 10 11:42:16 1998 Owen Taylor <otaylor@gtk.org>
* Makefile.am: Use MICO_LIBS variable from
......
......@@ -557,6 +557,11 @@ init_user_applets(void)
PANEL_UNKNOWN_APPLET_POSITION);
pos = gnome_config_get_int(buf);
panel = gnome_config_get_int("panel=0");
/*if we are to right stick this, make the number large, 9999 would
be 99990 pixels wide screen I doubt we'll have that anytime soon,
by that time somebody will fix this up:)*/
pos += gnome_config_get_bool("right_stick=false")?9999:0;
/*this is the config path to be passed to the applet when it
loads*/
......
......@@ -254,7 +254,10 @@ make_finfo_s(gchar *name, struct stat *s)
}
static GtkWidget *
create_menu_at (char *menudir, int create_app_menu, int applets, GList **finfo)
create_menu_at (char *menudir,
int create_app_menu,
int applets,
GList **finfo)
{
GnomeDesktopEntry *item_info;
GtkWidget *menu;
......
......@@ -652,6 +652,37 @@ panel_widget_shrink_wrap(PanelWidget *panel,
}
}
/*tells us if an applet is "stuck" on the right side*/
gint
panel_widget_is_applet_stuck(PanelWidget *panel, GtkWidget *applet)
{
AppletData *ad;
GList *list;
gint i;
g_return_val_if_fail(panel!=NULL,FALSE);
g_return_val_if_fail(applet!=NULL,FALSE);
ad = gtk_object_get_data(GTK_OBJECT(applet), PANEL_APPLET_DATA);
g_return_val_if_fail(ad!=NULL,FALSE);
list = g_list_find(panel->applet_list,ad);
g_return_val_if_fail(list!=NULL,FALSE);
do {
i=ad->pos+ad->cells;
if(i==panel->size)
return TRUE;
list = g_list_next(list);
if(!list)
break;
ad = list->data;
} while(ad->pos==i);
return FALSE;
}
/*this is a special function and may fail if called improperly, it works
only under special circumstance when we know there is nothing from
old_size to panel->size*/
......
......@@ -4,10 +4,7 @@
#include <gtk/gtk.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
BEGIN_GNOME_DECLS
#define PANEL_WIDGET(obj) GTK_CHECK_CAST (obj, panel_widget_get_type (), PanelWidget)
#define PANEL_WIDGET_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, panel_widget_get_type (), PanelWidgetClass)
......@@ -261,13 +258,13 @@ void panel_widget_set_drawer_pos (PanelWidget *panel,
/*get the number of applets*/
gint panel_widget_get_applet_count (PanelWidget *panel);
/*tells us if an applet is "stuck" on the right side*/
gint panel_widget_is_applet_stuck (PanelWidget *panel,
GtkWidget *applet);
extern GList *panels;
extern gint panel_applet_in_drag;
#ifdef __cplusplus
}
#endif /* __cplusplus */
END_GNOME_DECLS
#endif /* __PANEL_WIDGET_H__ */
......@@ -110,7 +110,6 @@ find_panel(PanelWidget *panel)
static void
save_applet_configuration(AppletInfo *info, gint *num)
{
char *fullpath;
char path[256];
int pos;
int panel;
......@@ -151,55 +150,43 @@ save_applet_configuration(AppletInfo *info, gint *num)
/*have the applet do it's own session saving*/
if(send_applet_session_save(info->id_str,info->applet_id,path,
panel_cfg_path)) {
fullpath = g_copy_strings(path,"id",NULL);
gnome_config_set_string(fullpath, EXTERN_ID);
g_free(fullpath);
fullpath = g_copy_strings(path,"position",NULL);
gnome_config_set_int(fullpath, pos);
g_free(fullpath);
fullpath = g_copy_strings(path,"panel",NULL);
gnome_config_set_int(fullpath, panel);
g_free(fullpath);
fullpath = g_copy_strings(path,"parameters",NULL);
gnome_config_set_string(fullpath, info->path);
g_free(fullpath);
fullpath = g_copy_strings(path,"parameters2",NULL);
gnome_config_set_string(fullpath, info->params);
g_free(fullpath);
gnome_config_push_prefix(path);
gnome_config_set_string("id", EXTERN_ID);
gnome_config_set_int("position", pos);
gnome_config_set_int("panel", panel);
gnome_config_set_string("parameters", info->path);
gnome_config_set_string("parameters2", info->params);
gnome_config_set_bool("right_stick",
panel_widget_is_applet_stuck(p,info->widget));
gnome_config_pop_prefix();
} else
(*num)--;
} else {
fullpath = g_copy_strings(path,"id",NULL);
gnome_config_set_string(fullpath, info->id_str);
g_free(fullpath);
fullpath = g_copy_strings(path,"position",NULL);
gnome_config_set_int(fullpath, pos);
g_free(fullpath);
gnome_config_push_prefix(path);
fullpath = g_copy_strings(path,"panel",NULL);
gnome_config_set_int(fullpath, panel);
g_free(fullpath);
gnome_config_set_string("id", info->id_str);
gnome_config_set_int("position", pos);
gnome_config_set_int("panel", panel);
gnome_config_set_bool("right_stick",
panel_widget_is_applet_stuck(p,info->widget));
fullpath = g_copy_strings(path,"parameters",NULL);
if(strcmp(info->id_str,DRAWER_ID) == 0) {
int i;
i = find_panel(PANEL_WIDGET(info->assoc));
if(i>=0)
gnome_config_set_int(fullpath,i);
gnome_config_set_int("parameters",i);
else
g_warning("Drawer not associated with applet!");
} else {
if(info->params)
gnome_config_set_string(fullpath, info->params);
gnome_config_set_string("parameters", info->params);
}
g_free(fullpath);
gnome_config_pop_prefix();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment