Commit 34002244 authored by Mark McLoughlin's avatar Mark McLoughlin Committed by Mark McLoughlin

load menus.

2002-01-07  Mark McLoughlin  <mark@skynet.ie>

        * applet.c: (panel_applet_load_from_unique_id),
        (panel_applet_save_to_gconf): load menus.

        * menu.[ch]: (add_menu_to_panel): upd.
        (load_menu_applet): add gconf_key arg.
        (menu_save_to_gconf), (menu_load_from_gconf): impl.

        * panel.c: (drop_menu): update for load_menu_applet change.

        * launcher.c: (launcher_save_to_gconf), (launcher_load_from_gconf):
        use object's keys, not applet's keys. doh.
parent 35eedce9
2002-01-07 Mark McLoughlin <mark@skynet.ie>
* applet.c: (panel_applet_load_from_unique_id),
(panel_applet_save_to_gconf): load menus.
* menu.[ch]: (add_menu_to_panel): upd.
(load_menu_applet): add gconf_key arg.
(menu_save_to_gconf), (menu_load_from_gconf): impl.
* panel.c: (drop_menu): update for load_menu_applet change.
* launcher.c: (launcher_save_to_gconf), (launcher_load_from_gconf):
use object's keys, not applet's keys. doh.
2002-01-07 Mark McLoughlin <mark@skynet.ie>
* applet.c: (panel_applet_get_full_gconf_key): fix silly.
......
......@@ -891,6 +891,7 @@ panel_applet_load_from_unique_id (AppletType type,
case APPLET_SWALLOW:
break;
case APPLET_MENU:
menu_load_from_gconf (panel_widget, position, unique_id);
break;
case APPLET_LAUNCHER:
launcher_load_from_gconf (panel_widget, position, unique_id);
......@@ -1024,6 +1025,8 @@ panel_applet_save_to_gconf (AppletInfo *applet_info)
case APPLET_SWALLOW:
break;
case APPLET_MENU:
menu_save_to_gconf ((Menu *) applet_info->data,
applet_info->gconf_key);
break;
case APPLET_LAUNCHER:
launcher_save_to_gconf ((Launcher *) applet_info->data,
......
......@@ -611,7 +611,7 @@ launcher_save_to_gconf (Launcher *launcher,
location = gnome_desktop_item_get_location (launcher->ditem);
temp_key = panel_gconf_applets_default_profile_get_full_key (profile, gconf_key, "base-location");
temp_key = panel_gconf_objects_default_profile_get_full_key (profile, gconf_key, "base-location");
gconf_client_set_string (client, temp_key, location, NULL);
g_free (temp_key);
}
......@@ -632,7 +632,7 @@ launcher_load_from_gconf (PanelWidget *panel_widget,
client = panel_gconf_get_client ();
profile = session_get_current_profile ();
temp_key = panel_gconf_applets_default_profile_get_full_key (profile, gconf_key, "base-location");
temp_key = panel_gconf_objects_default_profile_get_full_key (profile, gconf_key, "base-location");
base_location = gconf_client_get_string (client, temp_key, NULL);
g_free (temp_key);
......
......@@ -1110,7 +1110,8 @@ add_menu_to_panel (GtkWidget *widget, gpointer data)
NULL /* custom_icon_file */,
panel,
0 /* pos */,
FALSE /* exactpos */);
FALSE /* exactpos */,
NULL);
}
/*most of this function stolen from the real gtk_menu_popup*/
......@@ -4629,15 +4630,16 @@ set_menu_applet_orient(Menu *menu, PanelOrient orient)
}
void
load_menu_applet (const char *params,
gboolean main_menu,
int main_menu_flags,
gboolean global_main,
gboolean custom_icon,
const char *custom_icon_file,
load_menu_applet (const char *params,
gboolean main_menu,
int main_menu_flags,
gboolean global_main,
gboolean custom_icon,
const char *custom_icon_file,
PanelWidget *panel,
int pos,
gboolean exactpos)
int pos,
gboolean exactpos,
const char *gconf_key)
{
Menu *menu;
......@@ -4649,7 +4651,7 @@ load_menu_applet (const char *params,
AppletInfo *info;
info = panel_applet_register (menu->button, menu, free_menu, panel,
pos, exactpos, APPLET_MENU, NULL);
pos, exactpos, APPLET_MENU, gconf_key);
if (!info)
return;
......@@ -5076,3 +5078,96 @@ menu_allocated (GtkWidget *menu, GtkAllocation *alloc)
}
}
#endif
void
menu_save_to_gconf (Menu *menu,
const char *gconf_key)
{
GConfClient *client;
char *profile;
char *temp_key;
client = panel_gconf_get_client ();
profile = session_get_current_profile ();
temp_key = panel_gconf_objects_default_profile_get_full_key (profile, gconf_key, "path");
gconf_client_set_string (client, temp_key, menu->path, NULL);
g_free (temp_key);
temp_key = panel_gconf_objects_default_profile_get_full_key (profile, gconf_key, "main-menu");
gconf_client_set_bool (client, temp_key, menu->main_menu, NULL);
g_free (temp_key);
temp_key = panel_gconf_objects_default_profile_get_full_key (profile, gconf_key, "global-main");
gconf_client_set_bool (client, temp_key, menu->global_main, NULL);
g_free (temp_key);
temp_key = panel_gconf_objects_default_profile_get_full_key (profile, gconf_key, "custom-icon");
gconf_client_set_bool (client, temp_key, menu->custom_icon, NULL);
g_free (temp_key);
if (menu->custom_icon) {
temp_key = panel_gconf_objects_default_profile_get_full_key (profile, gconf_key, "custom-icon-file");
gconf_client_set_string (client, temp_key, menu->custom_icon_file, NULL);
g_free (temp_key);
}
temp_key = panel_gconf_objects_default_profile_get_full_key (profile, gconf_key, "main-menu-flags");
gconf_client_set_int (client, temp_key, menu->main_menu_flags, NULL);
g_free (temp_key);
}
void
menu_load_from_gconf (PanelWidget *panel_widget,
gint position,
const char *gconf_key)
{
GConfClient *client;
char *profile;
char *temp_key;
gboolean main_menu;
gboolean global_main;
gboolean custom_icon;
char *path;
char *custom_icon_file = NULL;
int flags;
g_return_if_fail (panel_widget);
g_return_if_fail (gconf_key);
client = panel_gconf_get_client ();
profile = session_get_current_profile ();
temp_key = panel_gconf_objects_default_profile_get_full_key (profile, gconf_key, "path");
path = gconf_client_get_string (client, temp_key, NULL);
g_free (temp_key);
temp_key = panel_gconf_objects_default_profile_get_full_key (profile, gconf_key, "main-menu");
main_menu = gconf_client_get_bool (client, temp_key, NULL);
g_free (temp_key);
temp_key = panel_gconf_objects_default_profile_get_full_key (profile, gconf_key, "global-main");
global_main = gconf_client_get_bool (client, temp_key, NULL);
g_free (temp_key);
temp_key = panel_gconf_objects_default_profile_get_full_key (profile, gconf_key, "custom-icon");
custom_icon = gconf_client_get_bool (client, temp_key, NULL);
g_free (temp_key);
if (custom_icon) {
temp_key = panel_gconf_objects_default_profile_get_full_key (profile, gconf_key, "custom-icon-file");
custom_icon_file = gconf_client_get_string (client, temp_key, NULL);
g_free (temp_key);
}
temp_key = panel_gconf_objects_default_profile_get_full_key (profile, gconf_key, "main-menu-flags");
flags = gconf_client_get_int (client, temp_key, NULL);
g_free (temp_key);
load_menu_applet (path, main_menu, flags, global_main,
custom_icon, custom_icon_file,
panel_widget, position, TRUE, gconf_key);
g_free (path);
g_free (custom_icon_file);
}
......@@ -47,15 +47,17 @@ struct _Menu {
AppletInfo *info;
};
void load_menu_applet (const char *path,
gboolean main_menu,
int main_menu_flags,
gboolean global_main,
gboolean custom_icon,
const char *custom_icon_file,
void load_menu_applet (const char *path,
gboolean main_menu,
int main_menu_flags,
gboolean global_main,
gboolean custom_icon,
const char *custom_icon_file,
PanelWidget *panel,
int pos,
gboolean exactpos);
int pos,
gboolean exactpos,
const char *gconf_key);
void add_menu_widget (Menu *menu,
PanelWidget *panel,
GSList *menudirl,
......@@ -114,6 +116,13 @@ GtkWidget * create_root_menu (GtkWidget *root_menu,
/* some gtk code cut-n-paste action */
void our_gtk_menu_position (GtkMenu *menu);
void menu_save_to_gconf (Menu *launcher,
const char *gconf_key);
void menu_load_from_gconf (PanelWidget *panel_widget,
gint position,
const char *gconf_key);
/* perhaps into basep-widget.h? */
enum {
HIDEBUTTONS_PIXMAP,
......
......@@ -882,7 +882,7 @@ drop_menu (PanelWidget *panel, int pos, const char *dir)
flags |= MAIN_MENU_KDE_SUB;
/* FIXME: checkout gnome-vfs stuff for drop, this should be
* a uri */
load_menu_applet (dir, FALSE /* main_menu */, flags, TRUE, FALSE, NULL, panel, pos, TRUE);
load_menu_applet (dir, FALSE /* main_menu */, flags, TRUE, FALSE, NULL, panel, pos, TRUE, NULL);
}
static gboolean
......
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