[gnome-panel] panel: add support for initial setup dialog
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] panel: add support for initial setup dialog
- Date: Sat, 15 Sep 2018 20:43:22 +0000 (UTC)
commit 69d6d002cf623dcae38e547ff45c9a276ffee6a2
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sat Sep 15 22:48:47 2018 +0300
panel: add support for initial setup dialog
gnome-panel/panel.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 95 insertions(+), 4 deletions(-)
---
diff --git a/gnome-panel/panel.c b/gnome-panel/panel.c
index e63740d87..4f31f31bf 100644
--- a/gnome-panel/panel.c
+++ b/gnome-panel/panel.c
@@ -27,6 +27,7 @@
#include "applet.h"
#include "button-widget.h"
#include "launcher.h"
+#include "panel-applets-manager.h"
#include "panel-bindings.h"
#include "panel-context-menu.h"
#include "panel-util.h"
@@ -1034,6 +1035,81 @@ drag_leave_cb (GtkWidget *widget,
panel_toplevel_queue_auto_hide (toplevel);
}
+
+typedef struct
+{
+ PanelWidget *panel;
+
+ GdkDragContext *context;
+ guint time;
+
+ PanelObjectPackType pack_type;
+ int pack_index;
+ gchar *iid;
+} InitialSetupData;
+
+static InitialSetupData *
+initial_setup_data_new (PanelWidget *panel,
+ GdkDragContext *context,
+ guint time,
+ PanelObjectPackType pack_type,
+ int pack_index,
+ const gchar *iid)
+{
+ InitialSetupData *data;
+
+ data = g_new0 (InitialSetupData, 1);
+
+ data->panel = panel;
+
+ data->context = context;
+ data->time = time;
+
+ data->pack_type = pack_type;
+ data->pack_index = pack_index;
+ data->iid = g_strdup (iid);
+
+ return data;
+}
+
+static void
+initial_setup_data_free (gpointer user_data)
+{
+ InitialSetupData *data;
+
+ data = (InitialSetupData *) user_data;
+
+ g_free (data->iid);
+ g_free (data);
+}
+
+static void
+initial_setup_dialog_cb (GpInitialSetupDialog *dialog,
+ gboolean canceled,
+ gpointer user_data)
+{
+ InitialSetupData *data;
+ GVariant *initial_settings;
+
+ data = (InitialSetupData *) user_data;
+
+ if (canceled) {
+ gtk_drag_finish (data->context, FALSE, FALSE, data->time);
+ return;
+ }
+
+ initial_settings = gp_initital_setup_dialog_get_settings (dialog);
+
+ panel_applet_frame_create (data->panel->toplevel,
+ data->pack_type,
+ data->pack_index,
+ data->iid,
+ initial_settings);
+
+ gtk_drag_finish (data->context, TRUE, FALSE, data->time);
+ g_variant_unref (initial_settings);
+}
+
static void
panel_receive_dnd_data (PanelWidget *panel,
guint info,
@@ -1079,10 +1155,25 @@ panel_receive_dnd_data (PanelWidget *panel,
return;
}
if (panel_layout_is_writable ()) {
- panel_applet_frame_create (panel->toplevel,
- pack_type, pack_index,
- (char *) data, NULL);
- success = TRUE;
+ InitialSetupData *initial_setup_data;
+
+ initial_setup_data = initial_setup_data_new (panel, context, time_,
+ pack_type, pack_index,
+ (char *) data);
+
+ if (!panel_applets_manager_open_initial_setup_dialog ((char *) data,
+ NULL,
+ initial_setup_dialog_cb,
+ initial_setup_data,
+ initial_setup_data_free)) {
+ panel_applet_frame_create (panel->toplevel,
+ pack_type, pack_index,
+ (char *) data, NULL);
+
+ success = TRUE;
+ } else {
+ return;
+ }
} else {
success = FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]