Browse Source

Implement property saving in the bindings.

If saving is enabled, the bindings won't restore the value
found in the channel, but instead notify to property on
the object so it gets stored.
upstream/xfce4-panel-4.10.1
Nick Schermer 13 years ago
parent
commit
a561ecbd2d
  1. 11
      common/panel-xfconf.c
  2. 3
      common/panel-xfconf.h
  3. 4
      panel/panel-application.c
  4. 2
      plugins/actions/actions.c
  5. 2
      plugins/launcher/launcher.c
  6. 2
      plugins/pager/pager.c
  7. 2
      plugins/separator/separator.c
  8. 2
      plugins/systray/systray.c
  9. 2
      plugins/tasklist/tasklist.c
  10. 2
      plugins/windowmenu/windowmenu.c

11
common/panel-xfconf.c

@ -193,7 +193,8 @@ void
panel_properties_bind (XfconfChannel *channel,
GObject *object,
const gchar *property_base,
const PanelProperty *properties)
const PanelProperty *properties,
gboolean save_properties)
{
const PanelProperty *prop;
const GValue *value;
@ -207,7 +208,9 @@ panel_properties_bind (XfconfChannel *channel,
panel_return_if_fail (properties != NULL);
/* get or ref the hash table */
if (shared_hash_table != NULL)
if (save_properties)
hash_table = NULL;
else if (shared_hash_table != NULL)
hash_table = g_hash_table_ref (shared_hash_table);
else
hash_table = xfconf_channel_get_properties (channel, property_base);
@ -244,6 +247,10 @@ panel_properties_bind (XfconfChannel *channel,
G_CALLBACK (panel_properties_object_notify), binding,
panel_properties_object_disconnect, 0);
/* emit the property so it gets saved */
if (save_properties)
g_object_notify (G_OBJECT (object), prop->property);
/* monitor channel changes */
g_snprintf (buf, sizeof (buf), "property-changed::%s", binding->channel_prop);
g_object_weak_ref (G_OBJECT (channel), panel_properties_channel_destroyed, binding);

3
common/panel-xfconf.h

@ -34,7 +34,8 @@ XfconfChannel *panel_properties_get_channel (void);
void panel_properties_bind (XfconfChannel *channel,
GObject *object,
const gchar *property_base,
const PanelProperty *properties);
const PanelProperty *properties,
gboolean save_properties);
void panel_properties_unbind (GObject *object);

4
panel/panel-application.c

@ -265,7 +265,7 @@ panel_application_finalize (GObject *object)
static void
panel_application_xfconf_window_bindings (PanelApplication *application,
PanelWindow *window,
gboolean store_settings)
gboolean save_properties)
{
gchar *property_base;
const PanelProperty properties[] =
@ -293,7 +293,7 @@ panel_application_xfconf_window_bindings (PanelApplication *application,
/* bind all the properties */
panel_properties_bind (application->xfconf, G_OBJECT (window),
property_base, properties);
property_base, properties, save_properties);
/* cleanup */
g_free (property_base);

2
plugins/actions/actions.c

@ -316,7 +316,7 @@ actions_plugin_construct (XfcePanelPlugin *panel_plugin)
/* bind all properties */
panel_properties_bind (plugin->channel, G_OBJECT (plugin),
xfce_panel_plugin_get_property_base (panel_plugin),
properties);
properties, FALSE);
/* set orientation and size */
actions_plugin_orientation_changed (panel_plugin,

2
plugins/launcher/launcher.c

@ -519,7 +519,7 @@ launcher_plugin_construct (XfcePanelPlugin *panel_plugin)
/* bind all properties */
panel_properties_bind (plugin->channel, G_OBJECT (plugin),
xfce_panel_plugin_get_property_base (panel_plugin),
properties);
properties, FALSE);
/* handle and empty plugin */
if (G_UNLIKELY (plugin->items == NULL))

2
plugins/pager/pager.c

@ -324,7 +324,7 @@ pager_plugin_construct (XfcePanelPlugin *panel_plugin)
/* bind all properties */
panel_properties_bind (plugin->channel, G_OBJECT (plugin),
xfce_panel_plugin_get_property_base (panel_plugin),
properties);
properties, FALSE);
/* create the pager */
g_signal_connect (G_OBJECT (plugin), "screen-changed",

2
plugins/separator/separator.c

@ -289,7 +289,7 @@ separator_plugin_construct (XfcePanelPlugin *panel_plugin)
/* connect all properties */
panel_properties_bind (plugin->channel, G_OBJECT (plugin),
xfce_panel_plugin_get_property_base (panel_plugin),
properties);
properties, FALSE);
/* make sure the plugin is drawn */
gtk_widget_queue_draw (GTK_WIDGET (panel_plugin));

2
plugins/systray/systray.c

@ -311,7 +311,7 @@ systray_plugin_construct (XfcePanelPlugin *panel_plugin)
/* bind all properties */
panel_properties_bind (plugin->channel, G_OBJECT (plugin),
xfce_panel_plugin_get_property_base (panel_plugin),
properties);
properties, FALSE);
/* monitor screen changes */
g_signal_connect (G_OBJECT (plugin), "screen-changed",

2
plugins/tasklist/tasklist.c

@ -150,7 +150,7 @@ tasklist_plugin_construct (XfcePanelPlugin *panel_plugin)
/* bind all properties */
panel_properties_bind (plugin->channel, G_OBJECT (plugin->tasklist),
xfce_panel_plugin_get_property_base (panel_plugin),
properties);
properties, FALSE);
/* show the tasklist */
gtk_widget_show (plugin->tasklist);

2
plugins/windowmenu/windowmenu.c

@ -403,7 +403,7 @@ window_menu_plugin_construct (XfcePanelPlugin *panel_plugin)
/* bind all properties */
panel_properties_bind (plugin->channel, G_OBJECT (plugin),
xfce_panel_plugin_get_property_base (panel_plugin),
properties);
properties, FALSE);
/* monitor screen changes */
g_signal_connect (G_OBJECT (plugin), "screen-changed",

Loading…
Cancel
Save