Browse Source

Allow passing a NULL channel to panel_properties_bind().

The binding will use the default panel and take care of ref-
counting.
upstream/xfce4-panel-4.10.1
Nick Schermer 13 years ago
parent
commit
68fff4fca0
  1. 10
      common/panel-xfconf.c
  2. 17
      plugins/actions/actions.c
  3. 10
      plugins/launcher/launcher.c
  4. 16
      plugins/pager/pager.c
  5. 17
      plugins/separator/separator.c
  6. 12
      plugins/systray/systray.c
  7. 14
      plugins/tasklist/tasklist.c
  8. 12
      plugins/windowmenu/windowmenu.c

10
common/panel-xfconf.c

@ -202,7 +202,7 @@ panel_properties_bind (XfconfChannel *channel,
PropertyBinding *binding;
GHashTable *hash_table;
panel_return_if_fail (XFCONF_IS_CHANNEL (channel));
panel_return_if_fail (channel == NULL || XFCONF_IS_CHANNEL (channel));
panel_return_if_fail (G_IS_OBJECT (object));
panel_return_if_fail (property_base != NULL && *property_base == '/');
panel_return_if_fail (properties != NULL);
@ -215,6 +215,14 @@ panel_properties_bind (XfconfChannel *channel,
else
hash_table = xfconf_channel_get_properties (channel, property_base);
if (G_LIKELY (channel == NULL))
{
/* use the default channel if none is set by the user and take
* care of refcounting */
channel = panel_properties_get_channel ();
g_object_weak_ref (G_OBJECT (object), (GWeakNotify) g_object_unref, channel);
}
/* walk the properties array */
for (prop = properties; prop->property != NULL; prop++)
{

17
plugins/actions/actions.c

@ -88,9 +88,6 @@ struct _ActionsPlugin
/* parent type */
XfcePanelPlugin __parent__;
/* xfconf channel */
XfconfChannel *channel;
/* widgets */
GtkWidget *box;
GtkWidget *first_button;
@ -310,11 +307,8 @@ actions_plugin_construct (XfcePanelPlugin *panel_plugin)
{ NULL, G_TYPE_NONE }
};
/* open the xfconf channel */
plugin->channel = panel_properties_get_channel ();
/* bind all properties */
panel_properties_bind (plugin->channel, G_OBJECT (plugin),
panel_properties_bind (NULL, G_OBJECT (plugin),
xfce_panel_plugin_get_property_base (panel_plugin),
properties, FALSE);
@ -331,14 +325,6 @@ actions_plugin_construct (XfcePanelPlugin *panel_plugin)
static void
actions_plugin_free_data (XfcePanelPlugin *panel_plugin)
{
ActionsPlugin *plugin = XFCE_ACTIONS_PLUGIN (panel_plugin);
panel_return_if_fail (XFCONF_IS_CHANNEL (plugin->channel));
/* release the xfonf channel */
if (G_LIKELY (plugin->channel != NULL))
g_object_unref (G_OBJECT (plugin->channel));
/* shutdown xfconf */
xfconf_shutdown ();
}
@ -383,7 +369,6 @@ actions_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
guint i;
panel_return_if_fail (XFCE_IS_ACTIONS_PLUGIN (plugin));
panel_return_if_fail (XFCONF_IS_CHANNEL (plugin->channel));
/* load the dialog from the glade file */
builder = gtk_builder_new ();

10
plugins/launcher/launcher.c

@ -107,8 +107,6 @@ struct _LauncherPlugin
{
XfcePanelPlugin __parent__;
XfconfChannel *channel;
GtkWidget *box;
GtkWidget *button;
GtkWidget *arrow;
@ -513,11 +511,8 @@ launcher_plugin_construct (XfcePanelPlugin *panel_plugin)
{ NULL, G_TYPE_NONE }
};
/* open the xfconf channel */
plugin->channel = panel_properties_get_channel ();
/* bind all properties */
panel_properties_bind (plugin->channel, G_OBJECT (plugin),
panel_properties_bind (NULL, G_OBJECT (plugin),
xfce_panel_plugin_get_property_base (panel_plugin),
properties, FALSE);
@ -559,9 +554,6 @@ launcher_plugin_free_data (XfcePanelPlugin *panel_plugin)
{
LauncherPlugin *plugin = XFCE_LAUNCHER_PLUGIN (panel_plugin);
/* release the xfconf channel */
g_object_unref (G_OBJECT (plugin->channel));
/* destroy the menu and timeout */
launcher_plugin_menu_destroy (plugin);

16
plugins/pager/pager.c

@ -70,9 +70,6 @@ struct _PagerPlugin
/* the wnck pager */
GtkWidget *wnck_pager;
/* xfconf channel */
XfconfChannel *channel;
/* the active wnck screen */
WnckScreen *wnck_screen;
@ -152,7 +149,6 @@ pager_plugin_init (PagerPlugin *plugin)
plugin->show_names = FALSE;
plugin->rows = 1;
plugin->wnck_pager = NULL;
plugin->channel = NULL;
/* show the properties dialog */
xfce_panel_plugin_menu_show_configure (XFCE_PANEL_PLUGIN (plugin));
@ -318,11 +314,8 @@ pager_plugin_construct (XfcePanelPlugin *panel_plugin)
{ NULL, G_TYPE_NONE }
};
/* open the xfconf channel */
plugin->channel = panel_properties_get_channel ();
/* bind all properties */
panel_properties_bind (plugin->channel, G_OBJECT (plugin),
panel_properties_bind (NULL, G_OBJECT (plugin),
xfce_panel_plugin_get_property_base (panel_plugin),
properties, FALSE);
@ -339,16 +332,10 @@ pager_plugin_free_data (XfcePanelPlugin *panel_plugin)
{
PagerPlugin *plugin = XFCE_PAGER_PLUGIN (panel_plugin);
panel_return_if_fail (XFCONF_IS_CHANNEL (plugin->channel));
/* disconnect screen changed signal */
g_signal_handlers_disconnect_by_func (G_OBJECT (plugin),
pager_plugin_screen_changed, NULL);
/* release the xfonf channel */
if (G_LIKELY (plugin->channel != NULL))
g_object_unref (G_OBJECT (plugin->channel));
/* shutdown xfconf */
xfconf_shutdown ();
}
@ -444,7 +431,6 @@ pager_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
GObject *dialog, *object;
panel_return_if_fail (XFCE_IS_PAGER_PLUGIN (plugin));
panel_return_if_fail (XFCONF_IS_CHANNEL (plugin->channel));
/* load the dialog from the glade file */
builder = gtk_builder_new ();

17
plugins/separator/separator.c

@ -77,9 +77,6 @@ struct _SeparatorPlugin
/* parent type */
XfcePanelPlugin __parent__;
/* xfconf channel */
XfconfChannel *channel;
/* separator style */
SeparatorPluginStyle style;
};
@ -283,11 +280,8 @@ separator_plugin_construct (XfcePanelPlugin *panel_plugin)
{ NULL, G_TYPE_NONE }
};
/* set the xfconf channel */
plugin->channel = panel_properties_get_channel ();
/* connect all properties */
panel_properties_bind (plugin->channel, G_OBJECT (plugin),
panel_properties_bind (NULL, G_OBJECT (plugin),
xfce_panel_plugin_get_property_base (panel_plugin),
properties, FALSE);
@ -300,14 +294,6 @@ separator_plugin_construct (XfcePanelPlugin *panel_plugin)
static void
separator_plugin_free_data (XfcePanelPlugin *panel_plugin)
{
SeparatorPlugin *plugin = XFCE_SEPARATOR_PLUGIN (panel_plugin);
panel_return_if_fail (XFCONF_IS_CHANNEL (plugin->channel));
/* release the xfonf channel */
if (G_LIKELY (plugin->channel != NULL))
g_object_unref (G_OBJECT (plugin->channel));
/* shutdown xfconf */
xfconf_shutdown ();
}
@ -341,7 +327,6 @@ separator_plugin_configure_plugin (XfcePanelPlugin *panel_plugin)
GObject *object;
panel_return_if_fail (XFCE_IS_SEPARATOR_PLUGIN (plugin));
panel_return_if_fail (XFCONF_IS_CHANNEL (plugin->channel));
/* load the dialog from the glade file */
builder = gtk_builder_new ();

12
plugins/systray/systray.c

@ -81,9 +81,6 @@ struct _SystrayPlugin
/* systray manager */
SystrayManager *manager;
/* xfconf channnel */
XfconfChannel *channel;
/* widgets */
GtkWidget *frame;
GtkWidget *box;
@ -305,11 +302,8 @@ systray_plugin_construct (XfcePanelPlugin *panel_plugin)
{ NULL, G_TYPE_NONE }
};
/* open the xfconf channel */
plugin->channel = panel_properties_get_channel ();
/* bind all properties */
panel_properties_bind (plugin->channel, G_OBJECT (plugin),
panel_properties_bind (NULL, G_OBJECT (plugin),
xfce_panel_plugin_get_property_base (panel_plugin),
properties, FALSE);
@ -336,10 +330,6 @@ systray_plugin_free_data (XfcePanelPlugin *panel_plugin)
if (G_LIKELY (plugin->manager))
g_object_unref (G_OBJECT (plugin->manager));
/* release the xfconf channel */
if (G_LIKELY (plugin->channel))
g_object_unref (G_OBJECT (plugin->channel));
/* shutdown xfconf */
xfconf_shutdown ();
}

14
plugins/tasklist/tasklist.c

@ -52,9 +52,6 @@ struct _TasklistPlugin
{
XfcePanelPlugin __parent__;
/* the xfconf channel */
XfconfChannel *channel;
/* the tasklist widget */
GtkWidget *tasklist;
GtkWidget *handle;
@ -144,11 +141,8 @@ tasklist_plugin_construct (XfcePanelPlugin *panel_plugin)
/* expand the plugin */
xfce_panel_plugin_set_expand (panel_plugin, TRUE);
/* open the xfconf channel */
plugin->channel = panel_properties_get_channel ();
/* bind all properties */
panel_properties_bind (plugin->channel, G_OBJECT (plugin->tasklist),
panel_properties_bind (NULL, G_OBJECT (plugin->tasklist),
xfce_panel_plugin_get_property_base (panel_plugin),
properties, FALSE);
@ -161,12 +155,6 @@ tasklist_plugin_construct (XfcePanelPlugin *panel_plugin)
static void
tasklist_plugin_free_data (XfcePanelPlugin *panel_plugin)
{
TasklistPlugin *plugin = XFCE_TASKLIST_PLUGIN (panel_plugin);
/* release the xfconf channel */
if (G_LIKELY (plugin->channel))
g_object_unref (G_OBJECT (plugin->channel));
/* shutdown xfconf */
xfconf_shutdown ();
}

12
plugins/windowmenu/windowmenu.c

@ -46,9 +46,6 @@ struct _WindowMenuPlugin
{
XfcePanelPlugin __parent__;
/* the xfconf channel */
XfconfChannel *channel;
/* the screen we're showing */
WnckScreen *screen;
@ -394,14 +391,11 @@ window_menu_plugin_construct (XfcePanelPlugin *panel_plugin)
{ NULL, G_TYPE_NONE }
};
/* open the xfconf channel */
plugin->channel = panel_properties_get_channel ();
/* show the icon */
gtk_widget_show (plugin->icon);
/* bind all properties */
panel_properties_bind (plugin->channel, G_OBJECT (plugin),
panel_properties_bind (NULL, G_OBJECT (plugin),
xfce_panel_plugin_get_property_base (panel_plugin),
properties, FALSE);
@ -441,10 +435,6 @@ window_menu_plugin_free_data (XfcePanelPlugin *panel_plugin)
plugin->screen = NULL;
}
/* release the xfconf channel */
if (G_LIKELY (plugin->channel))
g_object_unref (G_OBJECT (plugin->channel));
/* shutdown xfconf */
xfconf_shutdown ();
}

Loading…
Cancel
Save