Commit 9f93fc2f authored by Mark McLoughlin's avatar Mark McLoughlin Committed by Mark McLoughlin

add panel-main.h.

2001-12-19  Mark McLoughlin  <mark@skynet.ie>

        * Makefile.am: add panel-main.h.

        * panel-main.h: new file.

        * main.c: (panel_main_get_current_profile): impl.
          make panel_profile_name static.

        * panel-applet-frame.c: (panel_applet_frame_construct): append
        the prefs_key item to the iid to make the moniker.

        * menu.c: (create_new_panel): use panel_main_get_current_profile.

        * session.c: (session_init_panels): ditto.
parent 8949bd98
<!-- ##### SIGNAL PanelApplet::change-background ##### -->
<para>
Emitted when the background of the panel changes. Use @type to
determine which, if any, of @color and @pimxap is valid.
</para>
@panelapplet: The object which received the signal.
@arg1:
@arg2:
@arg3:
@type: The #PanelAppletBackgroundType.
@color: The #GdkColor if @type is #PANEL_COLOR_BACKGROUND.
@pixmap: The pixmap file name if @type is #PANEL_PIXMAP_BACKGROUND
<!-- ##### SIGNAL PanelApplet::change-orient ##### -->
<para>
Emitted when the orientation of the panel changes.
</para>
@panelapplet: The object which received the signal.
@arg1:
@orient: The new #PanelAppletOrient of the applet.
<!-- ##### SIGNAL PanelApplet::change-size ##### -->
<para>
Emitted when the size of the panel changes.
</para>
<para>
Note: this is different for size negotiation which is handled by
size_request() and size_allocate() as usual. This signal should
be used to determine what font size or widget layout to use
depending on the size of the panel.
</para>
@panelapplet: The object which received the signal.
@arg1:
@size: The size, in pixels, of the panel.
<!-- ##### STRUCT PanelAppletClass ##### -->
<para>
......
......@@ -79,8 +79,9 @@ background.
</para>
@widget:
@Returns:
<!-- # Unused Parameters # -->
@widget:
<!-- ##### FUNCTION panel_applet_get_size ##### -->
......@@ -170,3 +171,45 @@ Defines a 'main' routine for the applet factory.
@data: he factory user data pointer.
<!-- ##### SIGNAL PanelApplet::change-background ##### -->
<para>
Emitted when the background of the panel changes. Use @type to
determine which, if any, of @color and @pimxap is valid.
</para>
@panelapplet: The object which received the signal.
@arg1:
@arg2:
@arg3:
<!-- # Unused Parameters # -->
@type: The #PanelAppletBackgroundType.
@color: The #GdkColor if @type is #PANEL_COLOR_BACKGROUND.
@pixmap: The pixmap file name if @type is #PANEL_PIXMAP_BACKGROUND
<!-- ##### SIGNAL PanelApplet::change-orient ##### -->
<para>
Emitted when the orientation of the panel changes.
</para>
@panelapplet: The object which received the signal.
@arg1:
<!-- # Unused Parameters # -->
@orient: The new #PanelAppletOrient of the applet.
<!-- ##### SIGNAL PanelApplet::change-size ##### -->
<para>
Emitted when the size of the panel changes.
</para>
<para>
Note: this is different for size negotiation which is handled by
size_request() and size_allocate() as usual. This signal should
be used to determine what font size or widget layout to use
depending on the size of the panel.
</para>
@panelapplet: The object which received the signal.
@arg1:
<!-- # Unused Parameters # -->
@size: The size, in pixels, of the panel.
2001-12-19 Mark McLoughlin <mark@skynet.ie>
* Makefile.am: add panel-main.h.
* panel-main.h: new file.
* main.c: (panel_main_get_current_profile): impl.
make panel_profile_name static.
* panel-applet-frame.c: (panel_applet_frame_construct): append
the prefs_key item to the iid to make the moniker.
* menu.c: (create_new_panel): use panel_main_get_current_profile.
* session.c: (session_init_panels): ditto.
2001-12-19 Glynn Foster <glynn.foster@sun.com>
* aligned-widget.c, aligned-widget.h, applet-object.c, applet-widget.c,
......
......@@ -93,6 +93,7 @@ panel_sources = \
panel_headers = \
panel-types.h \
panel-widget.h \
panel-main.h \
basep-widget.h \
button-widget.h \
multiscreen-stuff.h \
......
......@@ -18,6 +18,8 @@
#include <libbonoboui.h>
#include <bonobo-activation/bonobo-activation.h>
#include "panel-main.h"
#include "conditional.h"
#include "drawer-widget.h"
#include "menu-fentry.h"
......@@ -26,13 +28,11 @@
#include "panel-util.h"
#include "panel-gconf.h"
#include "panel-config-global.h"
#include "panel-shell.h"
#include "session.h"
#include "status.h"
#include "xstuff.h"
/*#include "panel-unique-factory.h"*/
#include "panel-shell.h"
extern int config_sync_timeout;
extern GSList *panels;
......@@ -53,7 +53,13 @@ char *kde_menudir = NULL;
char *kde_icondir = NULL;
char *kde_mini_icondir = NULL;
gchar *panel_profile_name = NULL;
static gchar *panel_profile_name = NULL;
gchar *
panel_main_get_current_profile (void)
{
return panel_profile_name;
}
static gboolean
menu_age_timeout(gpointer data)
......
......@@ -53,6 +53,7 @@
#include "multiscreen-stuff.h"
#include "panel-util.h"
#include "panel-gconf.h"
#include "panel-main.h"
#include "panel.h"
#include "panel-config-global.h"
#include "session.h"
......@@ -90,8 +91,6 @@ extern char *kde_menudir;
extern char *kde_icondir;
extern gchar *panel_profile_name;
extern GtkTooltips *panel_tooltips;
enum {
......@@ -3052,7 +3051,7 @@ create_new_panel (GtkWidget *w, gpointer data)
panel = foobar_widget_new (screen);
/* Don't translate the first part of this string */
s = panel_gconf_panel_profile_get_conditional_string (panel_profile_name,
s = panel_gconf_panel_profile_get_conditional_string (panel_main_get_current_profile (),
(gchar *) PANEL_WIDGET (FOOBAR_WIDGET (panel)->panel)->unique_id,
"clock-format",
TRUE);
......
......@@ -27,6 +27,7 @@
#include "panel-applet-frame.h"
#include "panel-gconf.h"
#include "panel-main.h"
#include "applet.h"
#undef PANEL_APPLET_FRAME_DEBUG
......@@ -266,6 +267,8 @@ panel_applet_frame_instance_init (PanelAppletFrame *frame,
frame->priv->applet_shell = CORBA_OBJECT_NIL;
frame->priv->property_bag = CORBA_OBJECT_NIL;
frame->priv->applet_info = NULL;
frame->priv->unique_key = gconf_unique_key ();
}
GType
......@@ -325,8 +328,17 @@ panel_applet_frame_construct (PanelAppletFrame *frame,
Bonobo_Control control;
BonoboUIComponent *ui_component;
GtkWidget *widget;
gchar *moniker;
moniker = g_strdup_printf ("%s!prefs_key=/apps/panel/profiles/%s/applets/%s/prefs",
iid,
panel_main_get_current_profile (),
frame->priv->unique_key);
widget = bonobo_widget_new_control (moniker, NULL);
g_free (moniker);
widget = bonobo_widget_new_control (iid, NULL);
if (!widget) {
g_warning (G_STRLOC ": failed to load %s", iid);
return;
......@@ -334,8 +346,6 @@ panel_applet_frame_construct (PanelAppletFrame *frame,
frame->priv->iid = g_strdup (iid);
frame->priv->unique_key = gconf_unique_key ();
control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (widget));
control = bonobo_control_frame_get_control (control_frame);
......
#ifndef __PANEL_MAIN_H__
#define __PANEL_MAIN_H__
gchar *panel_main_get_current_profile (void);
#endif /* __PANEL_MAIN_H__ */
......@@ -38,6 +38,7 @@
#include "menu.h"
#include "panel-util.h"
#include "panel-gconf.h"
#include "panel-main.h"
#include "panel-config-global.h"
#include "session.h"
#include "sliding-widget.h"
......@@ -62,8 +63,6 @@ extern GSList *panels;
extern GSList *applets;
extern int applet_count;
extern gchar *panel_profile_name;
extern GtkTooltips *panel_tooltips;
extern GnomeClient *client;
......@@ -774,6 +773,7 @@ push_correct_global_prefix (void)
gnome_config_push_prefix ("=" GLOBAL_CONFDIR "/panel=/Config/");
}
#ifdef FIXME /* see session_load */
static void
session_init_user_applets (void)
{
......@@ -953,6 +953,7 @@ session_init_user_applets (void)
g_string_free (buf, TRUE);
g_free (prefix);
}
#endif /* FIXME */
static void
session_init_panels(void)
......@@ -967,7 +968,7 @@ session_init_panels(void)
GSList *temp;
gchar *timestring;
panel_profile_key = panel_gconf_general_profile_get_full_key (panel_profile_name, "panel-id-list");
panel_profile_key = panel_gconf_general_profile_get_full_key (panel_main_get_current_profile (), "panel-id-list");
if (panel_gconf_dir_exists (panel_profile_key) == FALSE) {
/* FIXME: We need to resort to another fallback default panel config
......@@ -1000,7 +1001,7 @@ session_init_panels(void)
int hidebutton_pixmaps_enabled;
int screen;
back_pixmap = panel_gconf_panel_profile_get_conditional_string (panel_profile_name,
back_pixmap = panel_gconf_panel_profile_get_conditional_string (panel_main_get_current_profile (),
(const gchar *) temp->data,
"panel-background-pixmap",
use_default);
......@@ -1009,7 +1010,7 @@ session_init_panels(void)
back_pixmap = NULL;
}
color = panel_gconf_panel_profile_get_conditional_string (panel_profile_name,
color = panel_gconf_panel_profile_get_conditional_string (panel_main_get_current_profile (),
(const gchar *) temp->data,
"panel-background-color",
use_default);
......@@ -1017,27 +1018,27 @@ session_init_panels(void)
gdk_color_parse (color, &back_color);
back_type = panel_gconf_panel_profile_get_conditional_int (panel_profile_name,
back_type = panel_gconf_panel_profile_get_conditional_int (panel_main_get_current_profile (),
(const gchar *) temp->data,
"panel-background-type",
use_default);
fit_pixmap_bg = panel_gconf_panel_profile_get_conditional_bool (panel_profile_name,
fit_pixmap_bg = panel_gconf_panel_profile_get_conditional_bool (panel_main_get_current_profile (),
(const gchar *) temp->data,
"panel-background-pixmap-fit",
use_default);
stretch_pixmap_bg = panel_gconf_panel_profile_get_conditional_bool (panel_profile_name,
stretch_pixmap_bg = panel_gconf_panel_profile_get_conditional_bool (panel_main_get_current_profile (),
(const gchar *) temp->data,
"panel-background-pixmap-stretch",
use_default);
rotate_pixmap_bg = panel_gconf_panel_profile_get_conditional_bool (panel_profile_name,
rotate_pixmap_bg = panel_gconf_panel_profile_get_conditional_bool (panel_main_get_current_profile (),
(const gchar *) temp->data,
"panel-background-pixmap-rotate",
use_default);
sz = panel_gconf_panel_profile_get_conditional_int (panel_profile_name,
sz = panel_gconf_panel_profile_get_conditional_int (panel_main_get_current_profile (),
(const gchar *) temp->data,
"panel-size",
use_default);
......@@ -1045,32 +1046,32 @@ session_init_panels(void)
/* Now for type specific config */
type = panel_gconf_panel_profile_get_conditional_int (panel_profile_name,
type = panel_gconf_panel_profile_get_conditional_int (panel_main_get_current_profile (),
(const gchar *) temp->data,
"panel-type",
use_default);
hidebuttons_enabled = panel_gconf_panel_profile_get_conditional_bool (panel_profile_name,
hidebuttons_enabled = panel_gconf_panel_profile_get_conditional_bool (panel_main_get_current_profile (),
(const gchar *) temp->data,
"hide-buttons-enabled",
use_default);
hidebutton_pixmaps_enabled = panel_gconf_panel_profile_get_conditional_bool (panel_profile_name,
hidebutton_pixmaps_enabled = panel_gconf_panel_profile_get_conditional_bool (panel_main_get_current_profile (),
(const gchar *) temp->data,
"hide-button-pixmaps-enabled",
use_default);
state = panel_gconf_panel_profile_get_conditional_int (panel_profile_name,
state = panel_gconf_panel_profile_get_conditional_int (panel_main_get_current_profile (),
(const gchar *) temp->data,
"panel-hide-state",
use_default);
mode = panel_gconf_panel_profile_get_conditional_int (panel_profile_name,
mode = panel_gconf_panel_profile_get_conditional_int (panel_main_get_current_profile (),
(const gchar *) temp->data,
"panel-hide-mode",
use_default);
screen = panel_gconf_panel_profile_get_conditional_int (panel_profile_name,
screen = panel_gconf_panel_profile_get_conditional_int (panel_main_get_current_profile (),
(const gchar *) temp->data,
"screen-id",
use_default);
......@@ -1078,7 +1079,7 @@ session_init_panels(void)
switch (type) {
case EDGE_PANEL:
edge = panel_gconf_panel_profile_get_conditional_int (panel_profile_name,
edge = panel_gconf_panel_profile_get_conditional_int (panel_main_get_current_profile (),
(const gchar *) temp->data,
"screen-edge",
use_default);
......@@ -1098,12 +1099,12 @@ session_init_panels(void)
case ALIGNED_PANEL: {
AlignedAlignment align;
edge = panel_gconf_panel_profile_get_conditional_int (panel_profile_name,
edge = panel_gconf_panel_profile_get_conditional_int (panel_main_get_current_profile (),
(const gchar *) temp->data,
"screen-edge",
use_default);
align = panel_gconf_panel_profile_get_conditional_int (panel_profile_name,
align = panel_gconf_panel_profile_get_conditional_int (panel_main_get_current_profile (),
(const gchar *) temp->data,
"panel-align",
use_default);
......@@ -1132,17 +1133,17 @@ session_init_panels(void)
gint16 offset;
SlidingAnchor anchor;
edge = panel_gconf_panel_profile_get_conditional_int (panel_profile_name,
edge = panel_gconf_panel_profile_get_conditional_int (panel_main_get_current_profile (),
(const gchar *) temp->data,
"screen-edge",
use_default);
anchor = panel_gconf_panel_profile_get_conditional_int (panel_profile_name,
anchor = panel_gconf_panel_profile_get_conditional_int (panel_main_get_current_profile (),
(const gchar *) temp->data,
"panel-anchor",
use_default);
offset = panel_gconf_panel_profile_get_conditional_int (panel_profile_name,
offset = panel_gconf_panel_profile_get_conditional_int (panel_main_get_current_profile (),
(const gchar *) temp->data,
"panel-offset",
use_default);
......@@ -1174,7 +1175,7 @@ session_init_panels(void)
case DRAWER_PANEL: {
PanelOrient orient;
orient = panel_gconf_panel_profile_get_conditional_int (panel_profile_name,
orient = panel_gconf_panel_profile_get_conditional_int (panel_main_get_current_profile (),
(const gchar *) temp->data,
"panel-orient",
use_default);
......@@ -1204,17 +1205,17 @@ session_init_panels(void)
GtkOrientation orient;
int x, y;
orient = panel_gconf_panel_profile_get_conditional_int (panel_profile_name,
orient = panel_gconf_panel_profile_get_conditional_int (panel_main_get_current_profile (),
(const gchar *) temp->data,
"panel-orient",
use_default);
x = panel_gconf_panel_profile_get_conditional_int (panel_profile_name,
x = panel_gconf_panel_profile_get_conditional_int (panel_main_get_current_profile (),
(const gchar *) temp->data,
"panel-x-position",
use_default);
y = panel_gconf_panel_profile_get_conditional_int (panel_profile_name,
y = panel_gconf_panel_profile_get_conditional_int (panel_main_get_current_profile (),
(const gchar *) temp->data,
"panel-y-position",
use_default);
......@@ -1248,7 +1249,7 @@ session_init_panels(void)
case FOOBAR_PANEL:
panel = foobar_widget_new (screen);
timestring = panel_gconf_panel_profile_get_conditional_string (panel_profile_name,
timestring = panel_gconf_panel_profile_get_conditional_string (panel_main_get_current_profile (),
(const gchar *) temp->data,
"clock-format",
use_default);
......@@ -1572,5 +1573,8 @@ session_write_global_config (void)
void session_load (void) {
session_init_panels ();
/* session_init_user_applets (); */
#ifdef FIXME /* load the applets */
session_init_user_applets ();
#endif
}
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