[Xfce4-commits] [xfce/thunar-volman] 11/11: Make settings pluggable
noreply at xfce.org
noreply at xfce.org
Sat Sep 9 16:05:01 CEST 2017
This is an automated email from the git hooks/post-receive script.
a n d r e p u s h e d a c o m m i t t o b r a n c h m a s t e r
in repository xfce/thunar-volman.
commit 0802ab0f4f942ebae0b39f56d5463a3378e5630d
Author: Andre Miranda <andre42m at gmail.com>
Date: Fri Sep 8 22:41:19 2017 -0300
Make settings pluggable
---
thunar-volman-settings/main.c | 40 ++++++++++++++++++----
.../thunar-volman-settings.desktop.in.in | 3 ++
2 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/thunar-volman-settings/main.c b/thunar-volman-settings/main.c
index f5e85be..d6ce5c5 100644
--- a/thunar-volman-settings/main.c
+++ b/thunar-volman-settings/main.c
@@ -30,20 +30,28 @@
#include <glib/gstdio.h>
#include <gtk/gtk.h>
+#include <gtk/gtkx.h>
+#include <libxfce4ui/libxfce4ui.h>
#include <libxfce4util/libxfce4util.h>
-
#include <xfconf/xfconf.h>
#include <thunar-volman-settings/tvm-preferences-dialog.h>
+static gint opt_socket_id = 0;
+GOptionEntry option_entries[] =
+{
+ { "socket-id", 's', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_INT, &opt_socket_id, N_("Settings manager socket"), N_("SOCKET ID") },
+};
+
int
main (int argc,
char **argv)
{
- GtkWidget *dialog;
+ GtkWidget *dialog, *plug, *plug_child;
GError *error = NULL;
+ GList *list;
/* setup translation domain */
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
@@ -63,7 +71,7 @@ main (int argc,
#endif
/* initialize GTK+ */
- if (!gtk_init_with_args (&argc, &argv, NULL, NULL, GETTEXT_PACKAGE, &error))
+ if (!gtk_init_with_args (&argc, &argv, NULL, option_entries, GETTEXT_PACKAGE, &error))
{
g_fprintf (stderr, "%s: %s.\n", g_get_prgname (), error->message);
g_error_free (error);
@@ -78,10 +86,30 @@ main (int argc,
return EXIT_FAILURE;
}
- /* display the dialog */
dialog = tvm_preferences_dialog_new ();
- gtk_widget_show (dialog);
- gtk_main ();
+
+ if (opt_socket_id == 0)
+ {
+ /* display the dialog */
+ gtk_widget_show (dialog);
+ gtk_main ();
+ }
+ else
+ {
+ /* create plug widget */
+ plug = gtk_plug_new (opt_socket_id);
+ g_signal_connect (plug, "delete-event", G_CALLBACK (gtk_main_quit), NULL);
+ gtk_widget_show (plug);
+
+ list = gtk_container_get_children (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))));
+ plug_child = list->data;
+ g_list_free (list);
+
+ xfce_widget_reparent (plug_child, plug);
+
+ gtk_main ();
+ gtk_widget_destroy (plug);
+ }
gtk_widget_destroy (dialog);
diff --git a/thunar-volman-settings/thunar-volman-settings.desktop.in.in b/thunar-volman-settings/thunar-volman-settings.desktop.in.in
index 33cde00..c689a97 100644
--- a/thunar-volman-settings/thunar-volman-settings.desktop.in.in
+++ b/thunar-volman-settings/thunar-volman-settings.desktop.in.in
@@ -7,5 +7,8 @@ Terminal=false
StartupNotify=true
Type=Application
Categories=XFCE;GTK;Settings;DesktopSettings;X-XFCE-SettingsDialog;X-XFCE-HardwareSettings;
+X-XfcePluggable=true
+X-XfceHelpComponent=thunar
+X-XfceHelpPage=using-removable-media
# vi:set encoding=UTF-8:
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list