[gnome-panel] rewrite panel properties dialog



commit 77a281ab38747315fd3f6a2802b673cd0d065b7a
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Oct 7 21:23:16 2016 +0300

    rewrite panel properties dialog

 ...rg.gnome.gnome-panel.toplevel.gschema.xml.in.in |   48 ++
 gnome-panel/Makefile.am                            |    6 +-
 gnome-panel/applet.c                               |    1 -
 gnome-panel/gp-properties-dialog.c                 |  532 +++++++++++++
 gnome-panel/gp-properties-dialog.h                 |   33 +
 ...roperties-dialog.ui => gp-properties-dialog.ui} |  802 +++++++++-----------
 gnome-panel/panel-context-menu.c                   |   44 +-
 gnome-panel/panel-properties-dialog.c              |  714 -----------------
 gnome-panel/panel-properties-dialog.h              |   34 -
 gnome-panel/panel.gresource.xml                    |    2 +-
 po/POTFILES.in                                     |    4 +-
 11 files changed, 1038 insertions(+), 1182 deletions(-)
---
diff --git a/data/org.gnome.gnome-panel.toplevel.gschema.xml.in.in 
b/data/org.gnome.gnome-panel.toplevel.gschema.xml.in.in
index 187f696..20e24d8 100644
--- a/data/org.gnome.gnome-panel.toplevel.gschema.xml.in.in
+++ b/data/org.gnome.gnome-panel.toplevel.gschema.xml.in.in
@@ -94,6 +94,7 @@
       <_description>The speed in which panel animations should occur. Possible values are "slow", "medium" 
and "fast". This key is only relevant if the enable_animations key is true.</_description>
     </key>
     <child name="background" schema="org.gnome.gnome-panel.toplevel.background"/>
+    <child name="theme" schema="org.gnome.gnome-panel.toplevel.theme"/>
   </schema>
   <schema id="org.gnome.gnome-panel.toplevel.background">
     <key name="type" enum="org.gnome.gnome-panel.PanelBackgroundType">
@@ -122,4 +123,51 @@
       <_description>Determines how the image set by image-uri is rendered. Possible values are "none", 
"stretch", "fit". With "stretch", the image will be scaled to the panel dimensions and the aspect ratio of 
the image will not be maintained. With "fit", the image will be scaled (retaining the aspect ratio of the 
image) to the panel height (if horizontal).</_description>
     </key>
   </schema>
+
+  <schema id="org.gnome.gnome-panel.toplevel.theme">
+
+    <key name="custom-bg-color" type="b">
+      <default>false</default>
+      <_summary>Use custom background color</_summary>
+    </key>
+
+    <key name="bg-color" type="s">
+      <default>'#000000'</default>
+      <_summary>Background Color</_summary>
+    </key>
+
+    <key name="custom-bg-image" type="b">
+      <default>false</default>
+      <_summary>Use custom background image</_summary>
+    </key>
+
+    <key name="bg-image" type="s">
+      <default>''</default>
+      <_summary>Background image</_summary>
+      <_description>Specifies the file to be used for the background image. If the image contains an alpha 
channel it will be composited onto the desktop background image.</_description>
+    </key>
+
+    <key name="bg-image-style" enum="org.gnome.gnome-panel.PanelBackgroundImageStyle">
+      <default>'none'</default>
+      <_summary>Image options</_summary>
+      <_description>Determines how the image set by image-uri is rendered. Possible values are "none", 
"stretch", "fit". With "stretch", the image will be scaled to the panel dimensions and the aspect ratio of 
the image will not be maintained. With "fit", the image will be scaled (retaining the aspect ratio of the 
image) to the panel height (if horizontal).</_description>
+    </key>
+
+    <key name="bg-image-rotate" type="b">
+      <default>false</default>
+      <_summary>Rotate image on vertical panels</_summary>
+      <_description>If true, the background image will be rotated when the panel is oriented 
vertically.</_description>
+    </key>
+
+    <key name="custom-fg-color" type="b">
+      <default>false</default>
+      <_summary>Use custom text color</_summary>
+    </key>
+
+    <key name="fg-color" type="s">
+      <default>'#ffffff'</default>
+      <_summary>Text Color</_summary>
+    </key>
+
+  </schema>
 </schemalist>
diff --git a/gnome-panel/Makefile.am b/gnome-panel/Makefile.am
index 70239dd..cb86f61 100644
--- a/gnome-panel/Makefile.am
+++ b/gnome-panel/Makefile.am
@@ -15,6 +15,8 @@ panel_sources =                       \
        $(gnome_panel_BUILT_SOURCES) \
        gp-arrow-button.c \
        gp-arrow-button.h \
+       gp-properties-dialog.c \
+       gp-properties-dialog.h \
        main.c                  \
        panel-widget.c          \
        button-widget.c         \
@@ -25,7 +27,6 @@ panel_sources =                       \
        panel.c                 \
        applet.c                \
        panel-util.c            \
-       panel-properties-dialog.c       \
        panel-run-dialog.c      \
        menu.c                  \
        panel-context-menu.c    \
@@ -71,7 +72,6 @@ panel_headers =                       \
        panel.h                 \
        applet.h                \
        panel-util.h            \
-       panel-properties-dialog.h       \
        panel-run-dialog.h      \
        menu.h                  \
        panel-context-menu.h    \
@@ -259,8 +259,8 @@ BUILT_SOURCES =                             \
        $(panel_test_applets_BUILT_SOURCES)
 
 ui_FILES =                                     \
+       gp-properties-dialog.ui \
        panel-addto-dialog.ui \
-       panel-properties-dialog.ui              \
        panel-run-dialog.ui
 
 panel-resources.c: panel.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --sourcedir=$(srcdir) 
--generate-dependencies $(srcdir)/panel.gresource.xml)
diff --git a/gnome-panel/applet.c b/gnome-panel/applet.c
index a0ad84f..b29f20c 100644
--- a/gnome-panel/applet.c
+++ b/gnome-panel/applet.c
@@ -29,7 +29,6 @@
 #include "panel-util.h"
 #include "panel-menu-button.h"
 #include "panel-globals.h"
-#include "panel-properties-dialog.h"
 #include "panel-layout.h"
 #include "panel-lockdown.h"
 #include "panel-schemas.h"
diff --git a/gnome-panel/gp-properties-dialog.c b/gnome-panel/gp-properties-dialog.c
new file mode 100644
index 0000000..d0f11ba
--- /dev/null
+++ b/gnome-panel/gp-properties-dialog.c
@@ -0,0 +1,532 @@
+/*
+ * Copyright (C) 2016 Alberts Muktupāvels
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <glib/gi18n.h>
+
+#include "gp-properties-dialog.h"
+
+struct _GpPropertiesDialog
+{
+  GtkWindow  parent;
+
+  gchar     *toplevel_id;
+
+  GSettings *toplevel;
+  GSettings *theme;
+
+  GtkWidget *toplevel_writable;
+  GtkWidget *theme_writable;
+
+  GtkWidget *orientation;
+  GtkWidget *size;
+  GtkWidget *expand;
+  GtkWidget *auto_hide;
+  GtkWidget *enable_buttons;
+  GtkWidget *enable_arrows;
+
+  GtkWidget *custom_bg_color;
+  GtkWidget *bg_color_box;
+  GtkWidget *bg_color;
+
+  GtkWidget *custom_bg_image;
+  GtkWidget *bg_image_box;
+  GtkWidget *bg_image;
+  GtkWidget *tile;
+  GtkWidget *stretch;
+  GtkWidget *fit;
+  GtkWidget *rotate;
+
+  GtkWidget *custom_fg_color;
+  GtkWidget *fg_color_box;
+  GtkWidget *fg_color;
+};
+
+enum
+{
+  PROP_0,
+
+  PROP_TOPLEVEL_ID,
+
+  LAST_PROP
+};
+
+static GParamSpec *properties[LAST_PROP] = { NULL };
+
+G_DEFINE_TYPE (GpPropertiesDialog, gp_properties_dialog, GTK_TYPE_WINDOW)
+
+static gboolean
+style_get (GValue   *value,
+           GVariant *variant,
+           gpointer  user_data)
+{
+  const gchar *str;
+
+  str = g_variant_get_string (variant, NULL);
+
+  if (g_strcmp0 (str, (const gchar *) user_data) == 0)
+    g_value_set_boolean (value, TRUE);
+  else
+    g_value_set_boolean (value, FALSE);
+
+  return TRUE;
+}
+
+static GVariant *
+style_set (const GValue       *value,
+           const GVariantType *expected_type,
+           gpointer            user_data)
+{
+  if (g_value_get_boolean (value))
+    return g_variant_new_string ((const gchar *) user_data);
+
+  return NULL;
+}
+
+static void
+bg_image_changed_cb (GSettings          *settings,
+                     const gchar        *key,
+                     GpPropertiesDialog *dialog)
+{
+  GtkFileChooser *chooser;
+  gchar *uri;
+
+  chooser = GTK_FILE_CHOOSER (dialog->bg_image);
+  uri = g_settings_get_string (dialog->theme, key);
+
+  if (!uri)
+    gtk_file_chooser_unselect_all (chooser);
+  else
+    gtk_file_chooser_set_uri (chooser, uri);
+
+  g_free (uri);
+}
+
+static void
+bg_image_file_set_cb (GtkFileChooserButton *button,
+                      GpPropertiesDialog   *dialog)
+{
+  gchar *uri;
+
+  uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (button));
+  if (!uri)
+    uri = g_strdup ("");
+
+  g_settings_set_string (dialog->theme, "bg-image", uri);
+  g_free (uri);
+}
+
+static void
+custom_bg_color_toggled_cb (GtkToggleButton    *button,
+                            GpPropertiesDialog *dialog)
+{
+  gboolean sensitive;
+
+  sensitive = gtk_toggle_button_get_active (button);
+
+  gtk_widget_set_sensitive (dialog->bg_color_box, sensitive);
+}
+
+static void
+custom_bg_image_toggled_cb (GtkToggleButton    *button,
+                            GpPropertiesDialog *dialog)
+{
+  gboolean sensitive;
+
+  sensitive = gtk_toggle_button_get_active (button);
+
+  gtk_widget_set_sensitive (dialog->bg_image_box, sensitive);
+}
+
+static void
+custom_fg_color_toggled_cb (GtkToggleButton    *button,
+                            GpPropertiesDialog *dialog)
+{
+  gboolean sensitive;
+
+  sensitive = gtk_toggle_button_get_active (button);
+
+  gtk_widget_set_sensitive (dialog->fg_color_box, sensitive);
+}
+
+static gboolean
+color_get (GValue   *value,
+           GVariant *variant,
+           gpointer  user_data)
+{
+  const gchar *color;
+  GdkRGBA rgba;
+
+  g_variant_get (variant, "&s", &color);
+
+  if (!gdk_rgba_parse (&rgba, color))
+    return FALSE;
+
+  g_value_set_boxed (value, &rgba);
+
+  return TRUE;
+}
+
+static GVariant *
+color_set (const GValue       *value,
+           const GVariantType *expected_type,
+           gpointer            user_data)
+{
+  GdkRGBA *rgba;
+  gchar *color;
+  GVariant *variant;
+
+  rgba = g_value_get_boxed (value);
+
+  if (!rgba)
+    return NULL;
+
+  color = gdk_rgba_to_string (rgba);
+  variant = g_variant_new_string (color);
+  g_free (color);
+
+  return variant;
+}
+
+static void
+setup_toplevel_bindings (GpPropertiesDialog *dialog)
+{
+  GtkComboBoxText *text;
+
+  text = GTK_COMBO_BOX_TEXT (dialog->orientation);
+
+  gtk_combo_box_text_append (text, "top", NC_("Orientation", "Top"));
+  gtk_combo_box_text_append (text, "bottom", NC_("Orientation", "Bottom"));
+  gtk_combo_box_text_append (text, "left", NC_("Orientation", "Left"));
+  gtk_combo_box_text_append (text, "right", NC_("Orientation", "Right"));
+
+  g_settings_bind (dialog->toplevel, "orientation",
+                   dialog->orientation, "active-id",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  g_settings_bind (dialog->toplevel, "size",
+                   dialog->size, "value",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  g_settings_bind (dialog->toplevel, "expand",
+                   dialog->expand, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  g_settings_bind (dialog->toplevel, "auto-hide",
+                   dialog->auto_hide, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  g_settings_bind (dialog->toplevel, "enable-buttons",
+                   dialog->enable_buttons, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  g_settings_bind (dialog->toplevel, "enable-arrows",
+                   dialog->enable_arrows, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+}
+
+static void
+setup_theme_bindings (GpPropertiesDialog *dialog)
+{
+  g_settings_bind (dialog->theme, "custom-bg-color",
+                   dialog->custom_bg_color, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  g_settings_bind_with_mapping (dialog->theme, "bg-color",
+                                dialog->bg_color, "rgba",
+                                G_SETTINGS_BIND_DEFAULT,
+                                color_get, color_set,
+                                NULL, NULL);
+
+  g_settings_bind (dialog->theme, "custom-bg-image",
+                   dialog->custom_bg_image, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  g_settings_bind_writable (dialog->theme, "bg-image",
+                            dialog->bg_image, "sensitive",
+                            FALSE);
+
+  g_signal_connect (dialog->theme, "changed::bg-image",
+                    G_CALLBACK (bg_image_changed_cb), dialog);
+
+  g_settings_bind_with_mapping (dialog->theme, "bg-image-style",
+                                dialog->tile, "active",
+                                G_SETTINGS_BIND_DEFAULT,
+                                style_get, style_set,
+                                (gpointer) "none",
+                                NULL);
+
+  g_settings_bind_with_mapping (dialog->theme, "bg-image-style",
+                                dialog->stretch, "active",
+                                G_SETTINGS_BIND_DEFAULT,
+                                style_get, style_set,
+                                (gpointer) "stretch",
+                                NULL);
+
+  g_settings_bind_with_mapping (dialog->theme, "bg-image-style",
+                                dialog->fit, "active",
+                                G_SETTINGS_BIND_DEFAULT,
+                                style_get, style_set,
+                                (gpointer) "fit",
+                                NULL);
+
+  g_settings_bind (dialog->theme, "bg-image-rotate",
+                   dialog->rotate, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  g_settings_bind (dialog->theme, "custom-fg-color",
+                   dialog->custom_fg_color, "active",
+                   G_SETTINGS_BIND_DEFAULT);
+
+  g_settings_bind_with_mapping (dialog->theme, "fg-color",
+                                dialog->fg_color, "rgba",
+                                G_SETTINGS_BIND_DEFAULT,
+                                color_get, color_set,
+                                NULL, NULL);
+
+  custom_bg_color_toggled_cb (GTK_TOGGLE_BUTTON (dialog->custom_bg_color), dialog);
+  custom_bg_image_toggled_cb (GTK_TOGGLE_BUTTON (dialog->custom_bg_image), dialog);
+  custom_fg_color_toggled_cb (GTK_TOGGLE_BUTTON (dialog->custom_fg_color), dialog);
+  bg_image_changed_cb (dialog->theme, "bg-image", dialog);
+}
+
+static gboolean
+all_keys_writable (GSettings    *settings,
+                   const gchar **keys)
+{
+  guint i;
+
+  for (i = 0; keys[i] != NULL; i++)
+    {
+      if (!g_settings_is_writable (settings, keys[i]))
+        return FALSE;
+    }
+
+  return TRUE;
+}
+
+static gboolean
+toplevel_writable_change_event_cb (GSettings          *settings,
+                                   guint               key,
+                                   GpPropertiesDialog *dialog)
+{
+  const gchar *toplevel[] = {
+    "orientation", "size", "expand", "auto-hide",
+    "enable-buttons", "enable-arrows", NULL
+  };
+  gboolean writable;
+
+  writable = all_keys_writable (settings, toplevel);
+  gtk_widget_set_visible (dialog->toplevel_writable, !writable);
+
+  return TRUE;
+}
+
+static gboolean
+theme_writable_change_event_cb (GSettings          *settings,
+                                guint               key,
+                                GpPropertiesDialog *dialog)
+{
+  const gchar *theme[] = {
+    "custom-bg-color", "bg-color", "custom-bg-image",
+    "bg-image", "bg-image-style", "bg-image-rotate",
+    "custom-fg-color", "fg-color", NULL
+  };
+  gboolean writable;
+
+  writable = all_keys_writable (settings, theme);
+  gtk_widget_set_visible (dialog->theme_writable, !writable);
+
+  return TRUE;
+}
+
+static void
+setup_writability (GpPropertiesDialog *dialog)
+{
+  g_signal_connect (dialog->toplevel, "writable-change-event",
+                    G_CALLBACK (toplevel_writable_change_event_cb),
+                    dialog);
+
+  g_signal_connect (dialog->theme, "writable-change-event",
+                    G_CALLBACK (theme_writable_change_event_cb),
+                    dialog);
+
+  toplevel_writable_change_event_cb (dialog->toplevel, 0, dialog);
+  theme_writable_change_event_cb (dialog->theme, 0, dialog);
+}
+
+static void
+setup_bindings (GpPropertiesDialog *dialog)
+{
+  setup_toplevel_bindings (dialog);
+  setup_theme_bindings (dialog);
+}
+
+static void
+gp_properties_dialog_constructed (GObject *object)
+{
+  GpPropertiesDialog *dialog;
+  const gchar *id;
+  const gchar *toplevel;
+  gchar *path;
+
+  dialog = GP_PROPERTIES_DIALOG (object);
+
+  G_OBJECT_CLASS (gp_properties_dialog_parent_class)->constructed (object);
+
+  id = dialog->toplevel_id;
+  toplevel = "org.gnome.gnome-panel.toplevel";
+
+  path = g_strdup_printf ("/org/gnome/gnome-panel/layout/toplevels/%s/", id);
+  dialog->toplevel = g_settings_new_with_path (toplevel, path);
+  dialog->theme = g_settings_get_child (dialog->toplevel, "theme");
+  g_free (path);
+
+  setup_writability (dialog);
+  setup_bindings (dialog);
+}
+
+static void
+gp_properties_dialog_dispose (GObject *object)
+{
+  GpPropertiesDialog *dialog;
+
+  dialog = GP_PROPERTIES_DIALOG (object);
+
+  g_clear_object (&dialog->toplevel);
+  g_clear_object (&dialog->theme);
+
+  G_OBJECT_CLASS (gp_properties_dialog_parent_class)->dispose (object);
+}
+
+static void
+gp_properties_dialog_finalize (GObject *object)
+{
+  GpPropertiesDialog *dialog;
+
+  dialog = GP_PROPERTIES_DIALOG (object);
+
+  g_free (dialog->toplevel_id);
+
+  G_OBJECT_CLASS (gp_properties_dialog_parent_class)->finalize (object);
+}
+
+static void
+gp_properties_dialog_set_property (GObject      *object,
+                                   guint         property_id,
+                                   const GValue *value,
+                                   GParamSpec   *pspec)
+{
+  GpPropertiesDialog *dialog;
+
+  dialog = GP_PROPERTIES_DIALOG (object);
+
+  switch (property_id)
+    {
+      case PROP_TOPLEVEL_ID:
+        dialog->toplevel_id = g_value_dup_string (value);
+        break;
+
+      default:
+        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+        break;
+    }
+}
+
+static void
+install_properties (GObjectClass *object_class)
+{
+  properties[PROP_TOPLEVEL_ID] =
+    g_param_spec_string ("toplevel-id", "toplevel-id", "toplevel-id",
+                         NULL, G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE |
+                         G_PARAM_STATIC_STRINGS);
+
+  g_object_class_install_properties (object_class, LAST_PROP, properties);
+}
+
+static void
+bind_template (GtkWidgetClass *widget_class)
+{
+  const gchar *resource;
+
+  resource = "/org/gnome/panel/gp-properties-dialog.ui";
+
+  gtk_widget_class_set_template_from_resource (widget_class, resource);
+
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, toplevel_writable);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, theme_writable);
+
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, orientation);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, size);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, expand);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, auto_hide);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, enable_buttons);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, enable_arrows);
+
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, custom_bg_color);
+  gtk_widget_class_bind_template_callback (widget_class, custom_bg_color_toggled_cb);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, bg_color_box);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, bg_color);
+
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, custom_bg_image);
+  gtk_widget_class_bind_template_callback (widget_class, custom_bg_image_toggled_cb);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, bg_image_box);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, bg_image);
+  gtk_widget_class_bind_template_callback (widget_class, bg_image_file_set_cb);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, tile);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, stretch);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, fit);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, rotate);
+
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, custom_fg_color);
+  gtk_widget_class_bind_template_callback (widget_class, custom_fg_color_toggled_cb);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, fg_color_box);
+  gtk_widget_class_bind_template_child (widget_class, GpPropertiesDialog, fg_color);
+}
+
+static void
+gp_properties_dialog_class_init (GpPropertiesDialogClass *dialog_class)
+{
+  GObjectClass *object_class;
+  GtkWidgetClass *widget_class;
+
+  object_class = G_OBJECT_CLASS (dialog_class);
+  widget_class = GTK_WIDGET_CLASS (dialog_class);
+
+  object_class->constructed = gp_properties_dialog_constructed;
+  object_class->dispose = gp_properties_dialog_dispose;
+  object_class->finalize = gp_properties_dialog_finalize;
+  object_class->set_property = gp_properties_dialog_set_property;
+
+  install_properties (object_class);
+  bind_template (widget_class);
+}
+
+static void
+gp_properties_dialog_init (GpPropertiesDialog *dialog)
+{
+  gtk_widget_init_template (GTK_WIDGET (dialog));
+}
+
+GtkWidget *
+gp_properties_dialog_new (const gchar *toplevel_id)
+{
+  return g_object_new (GP_TYPE_PROPERTIES_DIALOG,
+                       "toplevel-id", toplevel_id,
+                       NULL);
+}
diff --git a/gnome-panel/gp-properties-dialog.h b/gnome-panel/gp-properties-dialog.h
new file mode 100644
index 0000000..b166fff
--- /dev/null
+++ b/gnome-panel/gp-properties-dialog.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2016 Alberts Muktupāvels
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GP_PROPERTIES_DIALOG_H
+#define GP_PROPERTIES_DIALOG_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define GP_TYPE_PROPERTIES_DIALOG gp_properties_dialog_get_type ()
+G_DECLARE_FINAL_TYPE (GpPropertiesDialog, gp_properties_dialog,
+                      GP, PROPERTIES_DIALOG, GtkWindow)
+
+GtkWidget *gp_properties_dialog_new (const gchar *toplevel_id);
+
+G_END_DECLS
+
+#endif
diff --git a/gnome-panel/panel-properties-dialog.ui b/gnome-panel/gp-properties-dialog.ui
similarity index 52%
rename from gnome-panel/panel-properties-dialog.ui
rename to gnome-panel/gp-properties-dialog.ui
index 3ac3fc5..6644812 100644
--- a/gnome-panel/panel-properties-dialog.ui
+++ b/gnome-panel/gp-properties-dialog.ui
@@ -1,81 +1,149 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.19.0 -->
+<!-- Generated with glade 3.20.0 -->
 <interface>
-  <requires lib="gtk+" version="3.16"/>
-  <object class="GtkAdjustment" id="adjustment1">
-    <property name="upper">100</property>
-    <property name="value">33.75</property>
-    <property name="step_increment">5</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkAdjustment" id="adjustment2">
-    <property name="lower">12</property>
-    <property name="upper">120</property>
-    <property name="value">12</property>
+  <requires lib="gtk+" version="3.20"/>
+  <object class="GtkAdjustment" id="size">
+    <property name="lower">16</property>
+    <property name="upper">256</property>
+    <property name="value">24</property>
     <property name="step_increment">1</property>
-    <property name="page_increment">12</property>
+    <property name="page_increment">2</property>
   </object>
-  <object class="GtkDialog" id="panel_properties_dialog">
+  <template class="GpPropertiesDialog" parent="GtkWindow">
     <property name="can_focus">False</property>
-    <property name="border_width">5</property>
+    <property name="border_width">6</property>
     <property name="title" translatable="yes">Panel Properties</property>
     <property name="resizable">False</property>
     <property name="window_position">center</property>
+    <property name="default_width">340</property>
     <property name="type_hint">dialog</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox1">
+    <child>
+      <object class="GtkNotebook">
         <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="orientation">vertical</property>
-        <property name="spacing">2</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area1">
+        <property name="can_focus">True</property>
+        <child>
+          <object class="GtkBox">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="border_width">12</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">12</property>
             <child>
-              <object class="GtkButton" id="closebutton1">
-                <property name="label" translatable="yes">_Close</property>
+              <object class="GtkBox" id="toplevel_writable">
                 <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="has_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_underline">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">center</property>
+                <property name="spacing">10</property>
+                <child>
+                  <object class="GtkImage">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="icon_name">dialog-warning</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Some of these properties are locked 
down</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
               </object>
               <packing>
                 <property name="expand">False</property>
-                <property name="fill">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="label" translatable="yes">_Orientation:</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">orientation</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkComboBoxText" id="orientation">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_left">6</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
                 <property name="position">1</property>
               </packing>
             </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkNotebook" id="notebook">
-            <property name="visible">True</property>
-            <property name="can_focus">True</property>
-            <property name="border_width">5</property>
             <child>
-              <object class="GtkBox" id="general_vbox">
+              <object class="GtkBox">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="border_width">12</property>
                 <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
-                  <object class="GtkBox" id="writability_warn_general">
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="label" translatable="yes">_Size:</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">size_spin</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkBox">
+                    <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <property name="margin_left">6</property>
+                    <property name="spacing">6</property>
                     <child>
-                      <object class="GtkImage" id="image1">
+                      <object class="GtkSpinButton" id="size_spin">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="icon_name">dialog-warning</property>
+                        <property name="can_focus">True</property>
+                        <property name="hexpand">True</property>
+                        <property name="adjustment">size</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -84,14 +152,14 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkLabel" id="label19">
+                      <object class="GtkLabel">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Some of these properties are locked 
down</property>
+                        <property name="label" translatable="yes">pixels</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
-                        <property name="fill">False</property>
+                        <property name="fill">True</property>
                         <property name="position">1</property>
                       </packing>
                     </child>
@@ -99,89 +167,102 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkLabel">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="halign">start</property>
+                    <property name="label" translatable="yes">Miscellaneous:</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkGrid" id="general_table">
+                  <object class="GtkBox">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="row_spacing">6</property>
-                    <property name="column_spacing">12</property>
-                    <property name="row_homogeneous">True</property>
+                    <property name="margin_left">6</property>
+                    <property name="orientation">vertical</property>
                     <child>
-                      <object class="GtkBox" id="size_widgets">
+                      <object class="GtkCheckButton" id="expand">
+                        <property name="label" translatable="yes">E_xpand</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="spacing">6</property>
-                        <child>
-                          <object class="GtkSpinButton" id="size_spin">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="adjustment">adjustment2</property>
-                            <property name="climb_rate">1</property>
-                            <property name="numeric">True</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkLabel" id="size_label_pixels">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="label" translatable="yes">pixels</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
                       </object>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">1</property>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkComboBox" id="orientation_combo">
+                      <object class="GtkCheckButton" id="auto_hide">
+                        <property name="label" translatable="yes">_Autohide</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
                       </object>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">0</property>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkLabel" id="orientation_label">
+                      <object class="GtkCheckButton" id="enable_buttons">
+                        <property name="label" translatable="yes">Show hide _buttons</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">_Orientation:</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
                         <property name="use_underline">True</property>
-                        <property name="mnemonic_widget">orientation_combo</property>
-                        <property name="xalign">0</property>
+                        <property name="draw_indicator">True</property>
                       </object>
                       <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">0</property>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkLabel" id="size_label">
+                      <object class="GtkCheckButton" id="enable_arrows">
+                        <property name="label" translatable="yes">Arro_ws on hide buttons</property>
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">_Size:</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
                         <property name="use_underline">True</property>
-                        <property name="mnemonic_widget">size_spin</property>
-                        <property name="xalign">0</property>
+                        <property name="draw_indicator">True</property>
                       </object>
                       <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">1</property>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">3</property>
                       </packing>
                     </child>
                   </object>
@@ -191,154 +272,91 @@
                     <property name="position">1</property>
                   </packing>
                 </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">3</property>
+              </packing>
+            </child>
+          </object>
+        </child>
+        <child type="tab">
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">General</property>
+          </object>
+          <packing>
+            <property name="tab_fill">False</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="border_width">12</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">12</property>
+            <child>
+              <object class="GtkBox" id="theme_writable">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">center</property>
+                <property name="spacing">10</property>
                 <child>
-                  <object class="GtkCheckButton" id="expand_toggle">
-                    <property name="label" translatable="yes">E_xpand</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="use_underline">True</property>
-                    <property name="xalign">0.5</property>
-                    <property name="draw_indicator">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkCheckButton" id="autohide_toggle">
-                    <property name="label" translatable="yes">_Autohide</property>
+                  <object class="GtkImage">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="use_underline">True</property>
-                    <property name="xalign">0.5</property>
-                    <property name="draw_indicator">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="icon_name">dialog-warning</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">3</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkBox" id="vbox2">
+                  <object class="GtkLabel">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="orientation">vertical</property>
-                    <property name="spacing">6</property>
-                    <child>
-                      <object class="GtkCheckButton" id="hidebuttons_toggle">
-                        <property name="label" translatable="yes">Show hide _buttons</property>
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="xalign">0.5</property>
-                        <property name="draw_indicator">True</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkBox" id="hbox3">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <child>
-                          <object class="GtkLabel" id="label3">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="label">    </property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkCheckButton" id="arrows_toggle">
-                            <property name="label" translatable="yes">Arro_ws on hide buttons</property>
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="receives_default">False</property>
-                            <property name="use_underline">True</property>
-                            <property name="xalign">0.5</property>
-                            <property name="draw_indicator">True</property>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">True</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
+                    <property name="label" translatable="yes">Some of these properties are locked 
down</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">4</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
                   </packing>
                 </child>
               </object>
               <packing>
-                <property name="tab_fill">False</property>
-              </packing>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="label4">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">General</property>
-              </object>
-              <packing>
-                <property name="tab_fill">False</property>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
               </packing>
             </child>
             <child>
-              <object class="GtkBox" id="vbox5">
+              <object class="GtkBox">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="border_width">12</property>
                 <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
-                  <object class="GtkBox" id="writability_warn_background">
-                    <property name="can_focus">False</property>
-                    <child>
-                      <object class="GtkImage" id="image2">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="icon_name">dialog-warning</property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
+                  <object class="GtkCheckButton" id="custom_bg_color">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="draw_indicator">True</property>
+                    <signal name="toggled" handler="custom_bg_color_toggled_cb" object="GpPropertiesDialog" 
swapped="no"/>
                     <child>
-                      <object class="GtkLabel" id="label20">
+                      <object class="GtkLabel">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="label" translatable="yes">Some of these properties are locked 
down</property>
+                        <property name="label" translatable="yes">Background color:</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
                       </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">1</property>
-                      </packing>
                     </child>
                   </object>
                   <packing>
@@ -348,36 +366,17 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkRadioButton" id="default_radio">
-                    <property name="label" translatable="yes">_None (use system theme)</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="use_underline">True</property>
-                    <property name="xalign">0.5</property>
-                    <property name="draw_indicator">True</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkBox" id="hbox4">
+                  <object class="GtkBox" id="bg_color_box">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="spacing">6</property>
+                    <property name="margin_left">6</property>
+                    <property name="orientation">vertical</property>
                     <child>
-                      <object class="GtkRadioButton" id="color_radio">
-                        <property name="label" translatable="yes">Solid c_olor</property>
+                      <object class="GtkColorButton" id="bg_color">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="xalign">0.5</property>
-                        <property name="draw_indicator">True</property>
-                        <property name="group">default_radio</property>
+                        <property name="receives_default">True</property>
+                        <property name="use_alpha">True</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -389,92 +388,93 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
-                    <property name="position">2</property>
+                    <property name="position">1</property>
                   </packing>
                 </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">6</property>
                 <child>
-                  <object class="GtkBox" id="color_widgets">
+                  <object class="GtkCheckButton" id="custom_bg_image">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="draw_indicator">True</property>
+                    <signal name="toggled" handler="custom_bg_image_toggled_cb" object="GpPropertiesDialog" 
swapped="no"/>
                     <child>
-                      <object class="GtkLabel" id="label18">
+                      <object class="GtkLabel">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="label">    </property>
-                      </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">False</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkColorButton" id="color_button">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="hexpand">True</property>
-                        <property name="use_alpha">True</property>
-                        <property name="title" translatable="yes">Pick a color</property>
+                        <property name="label" translatable="yes">Background image:</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
                       </object>
-                      <packing>
-                        <property name="expand">False</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
                     </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
-                    <property name="position">3</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkBox" id="vbox6">
+                  <object class="GtkBox" id="bg_image_box">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <property name="margin_left">6</property>
                     <property name="orientation">vertical</property>
                     <property name="spacing">6</property>
                     <child>
-                      <object class="GtkRadioButton" id="image_radio">
-                        <property name="label" translatable="yes">Background _image:</property>
+                      <object class="GtkFileChooserButton" id="bg_image">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                        <property name="receives_default">False</property>
-                        <property name="use_underline">True</property>
-                        <property name="xalign">0.5</property>
-                        <property name="draw_indicator">True</property>
-                        <property name="group">default_radio</property>
+                        <property name="can_focus">False</property>
+                        <signal name="file-set" handler="bg_image_file_set_cb" object="GpPropertiesDialog" 
swapped="no"/>
                       </object>
                       <packing>
                         <property name="expand">False</property>
-                        <property name="fill">False</property>
+                        <property name="fill">True</property>
                         <property name="position">0</property>
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkBox" id="image_widgets">
+                      <object class="GtkBox">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
+                        <property name="spacing">12</property>
                         <child>
-                          <object class="GtkLabel" id="label7">
+                          <object class="GtkRadioButton" id="tile">
+                            <property name="label" translatable="yes">Tile</property>
                             <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="label">    </property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="active">True</property>
+                            <property name="draw_indicator">True</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
-                            <property name="fill">False</property>
+                            <property name="fill">True</property>
                             <property name="position">0</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkFileChooserButton" id="image_chooser">
+                          <object class="GtkRadioButton" id="stretch">
+                            <property name="label" translatable="yes">Stretch</property>
                             <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="hexpand">True</property>
-                            <property name="title" translatable="yes">Select background</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="draw_indicator">True</property>
+                            <property name="group">tile</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -482,187 +482,143 @@
                             <property name="position">1</property>
                           </packing>
                         </child>
+                        <child>
+                          <object class="GtkRadioButton" id="fit">
+                            <property name="label" translatable="yes">Fit</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="draw_indicator">True</property>
+                            <property name="group">tile</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
-                        <property name="fill">False</property>
+                        <property name="fill">True</property>
                         <property name="position">1</property>
                       </packing>
                     </child>
+                    <child>
+                      <object class="GtkCheckButton" id="rotate">
+                        <property name="label" translatable="yes">Rotate image on vertical panel</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">2</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">True</property>
-                    <property name="position">4</property>
+                    <property name="position">1</property>
                   </packing>
                 </child>
               </object>
               <packing>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="label5">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">Background</property>
-              </object>
-              <packing>
-                <property name="position">1</property>
-                <property name="tab_fill">False</property>
-              </packing>
-            </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">1</property>
-          </packing>
-        </child>
-      </object>
-    </child>
-    <action-widgets>
-      <action-widget response="-7">closebutton1</action-widget>
-    </action-widgets>
-  </object>
-  <object class="GtkDialog" id="image_details_dialog">
-    <property name="can_focus">False</property>
-    <property name="border_width">5</property>
-    <property name="title" translatable="yes">Image Background Details</property>
-    <property name="resizable">False</property>
-    <property name="type_hint">dialog</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="dialog-vbox2">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="orientation">vertical</property>
-        <child internal-child="action_area">
-          <object class="GtkButtonBox" id="dialog-action_area2">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <child>
-              <object class="GtkButton" id="closebutton2">
-                <property name="label" translatable="yes">_Close</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_underline">True</property>
-              </object>
-              <packing>
                 <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">1</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
               </packing>
             </child>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="pack_type">end</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-        <child>
-          <object class="GtkBox" id="vbox3">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="border_width">5</property>
-            <property name="orientation">vertical</property>
-            <property name="spacing">6</property>
-            <child>
-              <placeholder/>
-            </child>
             <child>
-              <object class="GtkBox" id="vbox4">
+              <object class="GtkBox">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <property name="orientation">vertical</property>
                 <property name="spacing">6</property>
                 <child>
-                  <object class="GtkRadioButton" id="tile_radio">
-                    <property name="label" translatable="yes">_Tile</property>
+                  <object class="GtkCheckButton" id="custom_fg_color">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">False</property>
-                    <property name="use_underline">True</property>
-                    <property name="xalign">0.5</property>
                     <property name="draw_indicator">True</property>
+                    <signal name="toggled" handler="custom_fg_color_toggled_cb" object="GpPropertiesDialog" 
swapped="no"/>
+                    <child>
+                      <object class="GtkLabel">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Text color:</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="fill">False</property>
+                    <property name="fill">True</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkRadioButton" id="scale_radio">
-                    <property name="label" translatable="yes">_Scale</property>
+                  <object class="GtkBox" id="fg_color_box">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="use_underline">True</property>
-                    <property name="xalign">0.5</property>
-                    <property name="draw_indicator">True</property>
-                    <property name="group">tile_radio</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_left">6</property>
+                    <property name="orientation">vertical</property>
+                    <child>
+                      <object class="GtkColorButton" id="fg_color">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="use_alpha">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="fill">False</property>
+                    <property name="fill">True</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
-                <child>
-                  <object class="GtkRadioButton" id="stretch_radio">
-                    <property name="label" translatable="yes">St_retch</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="use_underline">True</property>
-                    <property name="xalign">0.5</property>
-                    <property name="draw_indicator">True</property>
-                    <property name="group">tile_radio</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
               </object>
               <packing>
                 <property name="expand">False</property>
                 <property name="fill">True</property>
-                <property name="position">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkCheckButton" id="rotate_toggle">
-                <property name="label" translatable="yes">Rotate image when panel is _vertical</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_underline">True</property>
-                <property name="xalign">0.5</property>
-                <property name="draw_indicator">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
-                <property name="position">2</property>
+                <property name="position">3</property>
               </packing>
             </child>
           </object>
           <packing>
-            <property name="expand">False</property>
-            <property name="fill">False</property>
             <property name="position">1</property>
           </packing>
         </child>
+        <child type="tab">
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label" translatable="yes">Theme</property>
+          </object>
+          <packing>
+            <property name="position">1</property>
+            <property name="tab_fill">False</property>
+          </packing>
+        </child>
+        <child>
+          <placeholder/>
+        </child>
+        <child type="tab">
+          <placeholder/>
+        </child>
       </object>
     </child>
-    <action-widgets>
-      <action-widget response="-7">closebutton2</action-widget>
-    </action-widgets>
-  </object>
+  </template>
 </interface>
diff --git a/gnome-panel/panel-context-menu.c b/gnome-panel/panel-context-menu.c
index 470e6f2..da01d8b 100644
--- a/gnome-panel/panel-context-menu.c
+++ b/gnome-panel/panel-context-menu.c
@@ -39,7 +39,7 @@
 #include "panel-util.h"
 #include "panel.h"
 #include "menu.h"
-#include "panel-properties-dialog.h"
+#include "gp-properties-dialog.h"
 #include "panel-layout.h"
 #include "panel-lockdown.h"
 #include "panel-addto-dialog.h"
@@ -111,6 +111,42 @@ panel_context_menu_setup_delete_panel_item (GtkWidget *menu,
 }
 
 static void
+dialog_destroy_cb (GtkWidget     *dialog,
+                   PanelToplevel *toplevel)
+{
+  panel_toplevel_pop_autohide_disabler (toplevel);
+  g_object_set_data (G_OBJECT (toplevel), "gp-properties-dialog", NULL);
+}
+
+static void
+present_properties_dialog (GtkWidget     *widget,
+                           PanelToplevel *toplevel)
+{
+  GtkWidget *dialog;
+
+  dialog = g_object_get_data (G_OBJECT (toplevel), "gp-properties-dialog");
+
+  if (dialog == NULL)
+    {
+      const gchar *toplevel_id;
+
+      toplevel_id = panel_toplevel_get_id (toplevel);
+      dialog = gp_properties_dialog_new (toplevel_id);
+
+      g_signal_connect (dialog, "destroy",
+                        G_CALLBACK (dialog_destroy_cb),
+                        toplevel);
+
+      g_object_set_data_full (G_OBJECT (toplevel), "gp-properties-dialog",
+                              dialog, (GDestroyNotify) gtk_widget_destroy);
+
+      panel_toplevel_push_autohide_disabler (toplevel);
+    }
+
+  gtk_window_present (GTK_WINDOW (dialog));
+}
+
+static void
 panel_context_menu_build_edition (PanelWidget *panel_widget,
                                  GtkWidget   *menu)
 {
@@ -128,9 +164,9 @@ panel_context_menu_build_edition (PanelWidget *panel_widget,
        menuitem = gtk_menu_item_new_with_mnemonic (_("_Properties"));
        gtk_widget_show (menuitem);
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
-       g_signal_connect_swapped (menuitem, "activate",
-                                 G_CALLBACK (panel_properties_dialog_present), 
-                                 panel_widget->toplevel);
+       g_signal_connect (menuitem, "activate",
+                         G_CALLBACK (present_properties_dialog),
+                         panel_widget->toplevel);
 
        menuitem = gtk_menu_item_new_with_mnemonic (_("_Delete This Panel"));
        gtk_widget_show (menuitem);
diff --git a/gnome-panel/panel.gresource.xml b/gnome-panel/panel.gresource.xml
index 9f324b5..0858553 100644
--- a/gnome-panel/panel.gresource.xml
+++ b/gnome-panel/panel.gresource.xml
@@ -7,8 +7,8 @@
     <file alias="HighContrast/gnome-panel-dark.css">../data/theme/HighContrast/gnome-panel-dark.css</file>
   </gresource>
   <gresource prefix="/org/gnome/panel">
+    <file compressed="true">gp-properties-dialog.ui</file>
     <file compressed="true">panel-addto-dialog.ui</file>
-    <file compressed="true">panel-properties-dialog.ui</file>
     <file compressed="true">panel-run-dialog.ui</file>
     <file>wanda_no_sea.png</file>
   </gresource>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index b5d3cb4..40093d8 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -42,6 +42,8 @@ gnome-panel/button-widget.c
 gnome-panel/gnome-desktop-item-edit.c
 gnome-panel/gnome-panel.desktop.in.in
 gnome-panel/gp-arrow-button.c
+gnome-panel/gp-properties-dialog.c
+[type: gettext/glade]gnome-panel/gp-properties-dialog.ui
 gnome-panel/launcher.c
 gnome-panel/libpanel-util/panel-error.c
 gnome-panel/libpanel-util/panel-icon-chooser.c
@@ -64,8 +66,6 @@ gnome-panel/panel-menu-bar.c
 gnome-panel/panel-menu-button.c
 gnome-panel/panel-menu-items.c
 gnome-panel/panel-image-menu-item.c
-gnome-panel/panel-properties-dialog.c
-[type: gettext/glade]gnome-panel/panel-properties-dialog.ui
 gnome-panel/panel-recent.c
 gnome-panel/panel-run-dialog.c
 [type: gettext/glade]gnome-panel/panel-run-dialog.ui


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]