[Xfce4-commits] [panel-plugins/xfce4-indicator-plugin] 01/01: Fix blank properties window, but #10749
noreply at xfce.org
noreply at xfce.org
Sat Mar 15 01:25:47 CET 2014
This is an automated email from the git hooks/post-receive script.
andrzejr pushed a commit to branch master
in repository panel-plugins/xfce4-indicator-plugin.
commit 162fac0d77373c5c4195eea03dbaf8f02e924a1a
Author: Andrzej <ndrwrdck at gmail.com>
Date: Sat Mar 15 00:25:28 2014 +0000
Fix blank properties window, but #10749
---
panel-plugin/indicator-dialog.c | 56 +++++++++++++++------------------------
panel-plugin/indicator-dialog.h | 8 +++---
panel-plugin/indicator.c | 8 +++++-
3 files changed, 33 insertions(+), 39 deletions(-)
diff --git a/panel-plugin/indicator-dialog.c b/panel-plugin/indicator-dialog.c
index 849b467..7b7ec81 100644
--- a/panel-plugin/indicator-dialog.c
+++ b/panel-plugin/indicator-dialog.c
@@ -80,9 +80,6 @@ static const gchar *pretty_names[][3] =
#define ICON_SIZE (22)
static void indicator_dialog_build (IndicatorDialog *dialog);
-static void indicator_dialog_close_button_clicked (IndicatorDialog *dialog,
- GtkWidget *button);
-
static void indicator_dialog_help_button_clicked (IndicatorDialog *dialog,
GtkWidget *button);
@@ -481,8 +478,8 @@ indicator_dialog_build (IndicatorDialog *dialog)
object = gtk_builder_get_object (builder, "close-button");
g_return_if_fail (GTK_IS_BUTTON (object));
g_signal_connect_swapped (G_OBJECT (object), "clicked",
- G_CALLBACK (indicator_dialog_close_button_clicked),
- dialog);
+ G_CALLBACK (gtk_widget_destroy),
+ dialog->dialog);
object = gtk_builder_get_object (builder, "help-button");
g_return_if_fail (GTK_IS_BUTTON (object));
@@ -558,19 +555,6 @@ indicator_dialog_build (IndicatorDialog *dialog)
static void
-indicator_dialog_close_button_clicked (IndicatorDialog *dialog,
- GtkWidget *button)
-{
- g_return_if_fail (XFCE_IS_INDICATOR_DIALOG (dialog));
- g_return_if_fail (GTK_IS_BUTTON (button));
- g_return_if_fail (GTK_IS_WINDOW (dialog->dialog));
-
- gtk_widget_destroy (GTK_WIDGET (dialog->dialog));
- g_object_unref (G_OBJECT (dialog));
-}
-
-
-static void
indicator_dialog_help_button_clicked (IndicatorDialog *dialog,
GtkWidget *button)
{
@@ -598,26 +582,28 @@ indicator_dialog_help_button_clicked (IndicatorDialog *dialog,
void
-indicator_dialog_show (GdkScreen *screen,
- IndicatorConfig *config)
+indicator_dialog_show (IndicatorDialog *dialog,
+ GdkScreen *screen)
{
- static IndicatorDialog *dialog = NULL;
-
+ g_return_if_fail (XFCE_IS_INDICATOR_DIALOG (dialog));
g_return_if_fail (GDK_IS_SCREEN (screen));
- g_return_if_fail (XFCE_IS_INDICATOR_CONFIG (config));
- if (dialog == NULL)
- {
- dialog = g_object_new (XFCE_TYPE_INDICATOR_DIALOG, NULL);
- g_object_add_weak_pointer (G_OBJECT (dialog), (gpointer *) &dialog);
- dialog->config = config;
- indicator_dialog_build (XFCE_INDICATOR_DIALOG (dialog));
- gtk_widget_show (GTK_WIDGET (dialog->dialog));
- }
- else
- {
- gtk_window_present (GTK_WINDOW (dialog->dialog));
- }
+ indicator_dialog_build (XFCE_INDICATOR_DIALOG (dialog));
+ gtk_widget_show (GTK_WIDGET (dialog->dialog));
gtk_window_set_screen (GTK_WINDOW (dialog->dialog), screen);
}
+
+
+IndicatorDialog *
+indicator_dialog_new (IndicatorConfig *config)
+{
+ IndicatorDialog *dialog;
+
+ g_return_val_if_fail (XFCE_IS_INDICATOR_CONFIG (config), NULL);
+
+ dialog = g_object_new (XFCE_TYPE_INDICATOR_DIALOG, NULL);
+ dialog->config = config;
+
+ return dialog;
+}
diff --git a/panel-plugin/indicator-dialog.h b/panel-plugin/indicator-dialog.h
index 6117860..a1e57e9 100644
--- a/panel-plugin/indicator-dialog.h
+++ b/panel-plugin/indicator-dialog.h
@@ -34,10 +34,12 @@ typedef struct _IndicatorDialog IndicatorDialog;
#define XFCE_IS_INDICATOR_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XFCE_TYPE_INDICATOR_DIALOG))
#define XFCE_INDICATOR_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XFCE_TYPE_INDICATOR_DIALOG, IndicatorDialogClass))
-GType indicator_dialog_get_type (void) G_GNUC_CONST;
+GType indicator_dialog_get_type (void) G_GNUC_CONST;
-void indicator_dialog_show (GdkScreen *screen,
- IndicatorConfig *config);
+void indicator_dialog_show (IndicatorDialog *dialog,
+ GdkScreen *screen);
+
+IndicatorDialog *indicator_dialog_new (IndicatorConfig *config);
G_END_DECLS
diff --git a/panel-plugin/indicator.c b/panel-plugin/indicator.c
index b921046..475e230 100644
--- a/panel-plugin/indicator.c
+++ b/panel-plugin/indicator.c
@@ -92,6 +92,9 @@ struct _IndicatorPlugin
/* indicator settings */
IndicatorConfig *config;
+ /* config dialog builder */
+ IndicatorDialog *dialog;
+
/* log file */
FILE *logfile;
};
@@ -191,7 +194,7 @@ indicator_configure_plugin (XfcePanelPlugin *plugin)
{
IndicatorPlugin *indicator = XFCE_INDICATOR_PLUGIN (plugin);
- indicator_dialog_show (gtk_widget_get_screen (GTK_WIDGET (plugin)), indicator->config);
+ indicator_dialog_show (indicator->dialog, gtk_widget_get_screen (GTK_WIDGET (plugin)));
}
@@ -297,6 +300,9 @@ indicator_construct (XfcePanelPlugin *plugin)
/* initialize xfconf */
indicator->config = indicator_config_new (xfce_panel_plugin_get_property_base (plugin));
+ /* instantiate preference dialog builder */
+ indicator->dialog = indicator_dialog_new (indicator->config);
+
/* instantiate a button box */
indicator->buttonbox = xfce_indicator_box_new (indicator->config);
gtk_container_add (GTK_CONTAINER (plugin), GTK_WIDGET(indicator->buttonbox));
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list