[Xfce4-commits] <xfce4-terminal:nick/dropdown> Add preferences to drop-down window.

Nick Schermer noreply at xfce.org
Sat Dec 29 15:00:01 CET 2012


Updating branch refs/heads/nick/dropdown
         to 872f43319a6d10766e01955e28d20ced799137c6 (commit)
       from 2076c677fffce40c51c7f226fcde690a2ccad2c1 (commit)

commit 872f43319a6d10766e01955e28d20ced799137c6
Author: Nick Schermer <nick at xfce.org>
Date:   Sat Dec 29 14:58:03 2012 +0100

    Add preferences to drop-down window.

 terminal/Makefile.am                            |   28 +-
 terminal/terminal-preferences-dialog.c          |    5 +-
 terminal/terminal-preferences-dialog.h          |    2 +-
 terminal/terminal-preferences-dropdown-dialog.c |  206 +++++++++
 terminal/terminal-preferences-dropdown-dialog.h |   42 ++
 terminal/terminal-preferences-dropdown.glade    |  517 +++++++++++++++++++++++
 terminal/terminal-preferences.c                 |  104 +++++-
 terminal/terminal-window-dropdown.c             |  300 ++++++++++++--
 terminal/terminal-window.c                      |   25 +-
 9 files changed, 1156 insertions(+), 73 deletions(-)

diff --git a/terminal/Makefile.am b/terminal/Makefile.am
index 8cb9e2f..9df2e0f 100644
--- a/terminal/Makefile.am
+++ b/terminal/Makefile.am
@@ -13,7 +13,8 @@ xfce4_terminal_built_sources = \
 	terminal-enum-types.c \
 	terminal-enum-types.h \
 	terminal-marshal.c \
-	terminal-marshal.h
+	terminal-marshal.h \
+	terminal-window-ui.h
 
 xfce4_terminal_headers = \
 	terminal-app.h \
@@ -24,13 +25,13 @@ xfce4_terminal_headers = \
 	terminal-options.h \
 	terminal-preferences.h \
 	terminal-preferences-dialog.h \
+	terminal-preferences-dropdown-dialog.h \
 	terminal-search-dialog.h \
 	terminal-private.h \
 	terminal-screen.h \
 	terminal-widget.h \
 	terminal-window.h \ \
-	terminal-window-dropdown.h \
-	terminal-window-ui.h
+	terminal-window-dropdown.h
 
 xfce4_terminal_SOURCES = \
 	$(xfce4_terminal_built_sources) \
@@ -44,6 +45,7 @@ xfce4_terminal_SOURCES = \
 	terminal-options.c \
 	terminal-preferences.c \
 	terminal-preferences-dialog.c \
+	terminal-preferences-dropdown-dialog.c \
 	terminal-search-dialog.c \
 	terminal-screen.c \
 	terminal-widget.c \
@@ -72,7 +74,9 @@ xfce4_terminal_LDADD = \
 	$(TERMINAL_LIBS)
 
 uidir = $(datadir)/xfce4/terminal
-ui_DATA = terminal-preferences.ui
+ui_DATA = \
+	terminal-preferences.ui \
+	terminal-preferences-dropdown.ui
 
 ##
 ## Rules to auto-generate built sources
@@ -91,14 +95,12 @@ CLEANFILES = \
 	xgen-tmh
 
 DISTCLEANFILES = \
+	$(ui_DATA) \
+	$(xfce4_terminal_built_sources) \
 	stamp-terminal-enum-types.h \
-	stamp-terminal-marshal.h \
-	terminal-window-ui.h \
-	terminal-preferences.ui \
-	$(Terminal_built_sources)
+	stamp-terminal-marshal.h
 
 BUILT_SOURCES = \
-	terminal-window-ui.h \
 	$(xfce4_terminal_built_sources)
 
 terminal-window-ui.h: Makefile $(srcdir)/terminal-window-ui.xml
@@ -107,6 +109,9 @@ terminal-window-ui.h: Makefile $(srcdir)/terminal-window-ui.xml
 terminal-preferences.ui: $(srcdir)/terminal-preferences.glade Makefile
 	$(AM_V_GEN) $(XMLLINT) --nonet --noblanks $< > $@ || cat $< > $@
 
+terminal-preferences-dropdown.ui: $(srcdir)/terminal-preferences-dropdown.glade Makefile
+	$(AM_V_GEN) $(XMLLINT) --nonet --noblanks $< > $@ || cat $< > $@
+
 terminal-enum-types.h: stamp-terminal-enum-types.h
 	@true
 stamp-terminal-enum-types.h: terminal-preferences.h Makefile
@@ -154,11 +159,12 @@ endif
 clean-local:
 	rm -f *.core core core.*
 
-EXTRA_DIST =\
+EXTRA_DIST = \
 	$(ui_DATA) \
 	terminal-config.h.in \
 	terminal-marshal.list \
 	terminal-window-ui.xml \
-	terminal-preferences.glade
+	terminal-preferences.glade \
+	terminal-preferences-dropdown.glade
 
 # vi:set ts=8 sw=8 noet ai nocindent:
diff --git a/terminal/terminal-preferences-dialog.c b/terminal/terminal-preferences-dialog.c
index 1c659dd..52ebd59 100644
--- a/terminal/terminal-preferences-dialog.c
+++ b/terminal/terminal-preferences-dialog.c
@@ -733,20 +733,17 @@ terminal_preferences_dialog_encoding_changed (GtkComboBox               *combobo
 
 /**
  * terminal_preferences_dialog_new:
- * @parent      : A #GtkWindow or %NULL.
  *
  * Return value :
  **/
 GtkWidget*
-terminal_preferences_dialog_new (GtkWindow *parent)
+terminal_preferences_dialog_new (void)
 {
   GtkBuilder *builder;
   GObject    *dialog;
 
   builder = g_object_new (TERMINAL_TYPE_PREFERENCES_DIALOG, NULL);
   dialog = gtk_builder_get_object (builder, "dialog");
-  if (parent != NULL && dialog != NULL)
-    gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
 
   return GTK_WIDGET (dialog);
 }
diff --git a/terminal/terminal-preferences-dialog.h b/terminal/terminal-preferences-dialog.h
index 9e169fc..c30d675 100644
--- a/terminal/terminal-preferences-dialog.h
+++ b/terminal/terminal-preferences-dialog.h
@@ -37,7 +37,7 @@ typedef struct _TerminalPreferencesDialog      TerminalPreferencesDialog;
 
 GType      terminal_preferences_dialog_get_type (void) G_GNUC_CONST;
 
-GtkWidget *terminal_preferences_dialog_new      (GtkWindow *parent);
+GtkWidget *terminal_preferences_dialog_new      (void);
 
 G_END_DECLS
 
diff --git a/terminal/terminal-preferences-dropdown-dialog.c b/terminal/terminal-preferences-dropdown-dialog.c
new file mode 100644
index 0000000..2b61016
--- /dev/null
+++ b/terminal/terminal-preferences-dropdown-dialog.c
@@ -0,0 +1,206 @@
+/*-
+ * Copyright (C) 2012 Nick Schermer <nick at xfce.org>
+ *
+ * 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <libxfce4ui/libxfce4ui.h>
+
+#include <terminal/terminal-dialogs.h>
+#include <terminal/terminal-enum-types.h>
+#include <terminal/terminal-preferences.h>
+#include <terminal/terminal-preferences-dropdown-dialog.h>
+#include <terminal/terminal-private.h>
+
+
+
+static void terminal_preferences_dropdown_dialog_finalize (GObject                           *object);
+static void terminal_preferences_dropdown_dialog_response (GtkWidget                         *widget,
+                                                           gint                               response,
+                                                           TerminalPreferencesDropdownDialog *dialog);
+
+
+
+struct _TerminalPreferencesDropdownDialogClass
+{
+  GtkBuilderClass __parent__;
+};
+
+struct _TerminalPreferencesDropdownDialog
+{
+  GtkBuilder __parent__;
+
+  TerminalPreferences *preferences;
+  GSList              *bindings;
+};
+
+
+
+G_DEFINE_TYPE (TerminalPreferencesDropdownDialog, terminal_preferences_dropdown_dialog, GTK_TYPE_BUILDER)
+
+
+
+static void
+terminal_preferences_dropdown_dialog_class_init (TerminalPreferencesDropdownDialogClass *klass)
+{
+  GObjectClass *gobject_class;
+
+  gobject_class = G_OBJECT_CLASS (klass);
+  gobject_class->finalize = terminal_preferences_dropdown_dialog_finalize;
+}
+
+
+
+#define BIND_PROPERTIES(name, property) \
+  G_STMT_START { \
+  object = gtk_builder_get_object (GTK_BUILDER (dialog), name); \
+  terminal_return_if_fail (G_IS_OBJECT (object)); \
+  binding = g_object_bind_property (G_OBJECT (dialog->preferences), name, \
+                                    G_OBJECT (object), property, \
+                                    G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL); \
+  dialog->bindings = g_slist_prepend (dialog->bindings, binding); \
+  } G_STMT_END
+
+
+
+static void
+terminal_preferences_dropdown_dialog_init (TerminalPreferencesDropdownDialog *dialog)
+{
+  GError           *error = NULL;
+  guint             i;
+  GObject          *object;
+  gchar            *file;
+  GBinding         *binding;
+  const gchar      *props_active[] = { "dropdown-keep-open-default",
+                                       "dropdown-keep-above",
+                                       "dropdown-toggle-focus",
+                                       "dropdown-status-icon",
+                                       "dropdown-move-to-active" };
+  const gchar      *props_value[] = { "dropdown-height",
+                                      "dropdown-width",
+                                      "dropdown-position",
+                                      "dropdown-opacity" };
+
+  dialog->preferences = terminal_preferences_get ();
+
+  /* hack to initialize the XfceTitledDialog class */
+  if (xfce_titled_dialog_get_type () == 0)
+    return;
+
+  /* lookup the ui file */
+  xfce_resource_push_path (XFCE_RESOURCE_DATA, DATADIR);
+  file = xfce_resource_lookup (XFCE_RESOURCE_DATA, "xfce4/terminal/terminal-preferences-dropdown.ui");
+  xfce_resource_pop_path (XFCE_RESOURCE_DATA);
+
+  if (G_UNLIKELY (file == NULL))
+    {
+      g_set_error (&error, 0, 0, "file not found");
+      goto error;
+    }
+
+  /* load the builder data into the object */
+  if (gtk_builder_add_from_file (GTK_BUILDER (dialog), file, &error) == 0)
+    {
+error:
+      g_critical ("Failed to load ui file: %s.", error->message);
+      g_error_free (error);
+      return;
+    }
+
+  /* connect response to dialog */
+  object = gtk_builder_get_object (GTK_BUILDER (dialog), "dialog");
+  terminal_return_if_fail (G_IS_OBJECT (object));
+  g_object_weak_ref (G_OBJECT (object), (GWeakNotify) g_object_unref, dialog);
+  g_signal_connect (G_OBJECT (object), "response",
+      G_CALLBACK (terminal_preferences_dropdown_dialog_response), dialog);
+
+  /* bind active properties */
+  for (i = 0; i < G_N_ELEMENTS (props_active); i++)
+    BIND_PROPERTIES (props_active[i], "active");
+
+  /* bind adjustment properties */
+  for (i = 0; i < G_N_ELEMENTS (props_value); i++)
+    BIND_PROPERTIES (props_value[i], "value");
+
+  object = gtk_builder_get_object (GTK_BUILDER (dialog), "scale-position");
+  terminal_return_if_fail (G_IS_OBJECT (object));
+  for (i = 0; i <= 100; i += 25)
+    gtk_scale_add_mark (GTK_SCALE (object), i, GTK_POS_BOTTOM, NULL);
+}
+
+
+
+static void
+terminal_preferences_dropdown_dialog_finalize (GObject *object)
+{
+  TerminalPreferencesDropdownDialog *dialog = TERMINAL_PREFERENCES_DROPDOWN_DIALOG (object);
+
+  /* release the preferences */
+  g_object_unref (G_OBJECT (dialog->preferences));
+
+  (*G_OBJECT_CLASS (terminal_preferences_dropdown_dialog_parent_class)->finalize) (object);
+}
+
+
+
+static void
+terminal_preferences_dropdown_dialog_response (GtkWidget                         *widget,
+                                               gint                               response,
+                                               TerminalPreferencesDropdownDialog *dialog)
+{
+  GSList *li;
+
+  /* check if we should open the user manual */
+  if (G_UNLIKELY (response == 1))
+    {
+      /* open the "PreferencesDropdown" section of the user manual */
+      xfce_dialog_show_help (GTK_WINDOW (widget), "terminal",
+                             "dropdown", NULL);
+    }
+  else
+    {
+      /* disconnect all the bindings */
+      for (li = dialog->bindings; li != NULL; li = li->next)
+        g_object_unref (G_OBJECT (li->data));
+      g_slist_free (dialog->bindings);
+
+      /* close the preferences dialog */
+      gtk_widget_destroy (widget);
+    }
+}
+
+
+
+/**
+ * terminal_preferences_dropdown_dialog_new:
+ * @parent      : A #GtkWindow or %NULL.
+ *
+ * Return value :
+ **/
+GtkWidget*
+terminal_preferences_dropdown_dialog_new (void)
+{
+  GtkBuilder *builder;
+  GObject    *dialog;
+
+  builder = g_object_new (TERMINAL_TYPE_PREFERENCES_DROPDOWN_DIALOG, NULL);
+  dialog = gtk_builder_get_object (builder, "dialog");
+
+  return GTK_WIDGET (dialog);
+}
diff --git a/terminal/terminal-preferences-dropdown-dialog.h b/terminal/terminal-preferences-dropdown-dialog.h
new file mode 100644
index 0000000..659542f
--- /dev/null
+++ b/terminal/terminal-preferences-dropdown-dialog.h
@@ -0,0 +1,42 @@
+/*-
+ * Copyright (C) 2012 Nick Schermer <nick at xfce.org>
+ *
+ * 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, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef __TERMINAL_PREFERENCES_DROPDOWN_DROPDOWN_DIALOG_H__
+#define __TERMINAL_PREFERENCES_DROPDOWN_DROPDOWN_DIALOG_H__
+
+#include <terminal/terminal-preferences.h>
+
+G_BEGIN_DECLS
+
+#define TERMINAL_TYPE_PREFERENCES_DROPDOWN_DIALOG            (terminal_preferences_dropdown_dialog_get_type ())
+#define TERMINAL_PREFERENCES_DROPDOWN_DIALOG(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), TERMINAL_TYPE_PREFERENCES_DROPDOWN_DIALOG, TerminalPreferencesDropdownDialog))
+#define TERMINAL_PREFERENCES_DROPDOWN_DIALOG_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), TERMINAL_TYPE_PREFERENCES_DROPDOWN_DIALOG, TerminalPreferencesDropdownDialogClass))
+#define TERMINAL_IS_PREFERENCES_DROPDOWN_DIALOG(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TERMINAL_TYPE_PREFERENCES_DROPDOWN_DIALOG))
+#define TERMINAL_IS_PREFERENCES_DROPDOWN_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), TERMINAL_TYPE_PREFERENCES_DROPDOWN_DIALOG))
+#define TERMINAL_PREFERENCES_DROPDOWN_DIALOG_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), TERMINAL_TYPE_PREFERENCES_DROPDOWN_DIALOG, TerminalPreferencesDropdownDialogClass))
+
+typedef struct _TerminalPreferencesDropdownDialogClass TerminalPreferencesDropdownDialogClass;
+typedef struct _TerminalPreferencesDropdownDialog      TerminalPreferencesDropdownDialog;
+
+GType      terminal_preferences_dropdown_dialog_get_type (void) G_GNUC_CONST;
+
+GtkWidget *terminal_preferences_dropdown_dialog_new      (void);
+
+G_END_DECLS
+
+#endif /* !__TERMINAL_PREFERENCES_DROPDOWN_DROPDOWN_DIALOG_H__ */
diff --git a/terminal/terminal-preferences-dropdown.glade b/terminal/terminal-preferences-dropdown.glade
new file mode 100644
index 0000000..20a6dc7
--- /dev/null
+++ b/terminal/terminal-preferences-dropdown.glade
@@ -0,0 +1,517 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <requires lib="gtk+" version="2.24"/>
+  <!-- interface-requires libxfce4ui 4.5 -->
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkAdjustment" id="dropdown-height">
+    <property name="lower">10</property>
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="XfceTitledDialog" id="dialog">
+    <property name="can_focus">False</property>
+    <property name="title" translatable="yes">Drop-down Preferences</property>
+    <property name="icon_name">utilities-terminal</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkVBox" id="dialog-vbox1">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <child internal-child="action_area">
+          <object class="GtkHButtonBox" id="dialog-action_area1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="button1">
+                <property name="label">gtk-help</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</property>
+                <property name="position">0</property>
+                <property name="secondary">True</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="button2">
+                <property name="label">gtk-close</property>
+                <property name="use_action_appearance">False</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">False</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="GtkVBox" id="vbox1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="border_width">6</property>
+            <property name="spacing">6</property>
+            <child>
+              <object class="GtkFrame" id="frame2">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkVBox" id="vbox2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="border_width">6</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkCheckButton" id="dropdown-keep-open-default">
+                            <property name="label" translatable="yes">_Keep window open when it loses focus</property>
+                            <property name="use_action_appearance">False</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">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="dropdown-keep-above">
+                            <property name="label" translatable="yes">Always keep window op _top</property>
+                            <property name="use_action_appearance">False</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">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="dropdown-toggle-focus">
+                            <property name="label" translatable="yes">Use shortcut to _focus visible window</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="tooltip_text" translatable="yes">If enabled, the shortcut to open en retract the window will give focus, rather than closing it, if it has previously lost focus</property>
+                            <property name="use_underline">True</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="dropdown-status-icon">
+                            <property name="label" translatable="yes">Show _status icon in notification area</property>
+                            <property name="use_action_appearance">False</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">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">3</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label8">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Behaviour</property>
+                    <property name="use_markup">True</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkFrame" id="frame1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkTable" id="table1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="border_width">6</property>
+                        <property name="n_rows">3</property>
+                        <property name="n_columns">2</property>
+                        <property name="column_spacing">12</property>
+                        <property name="row_spacing">6</property>
+                        <child>
+                          <object class="GtkLabel" id="label5">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">_Width:</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">scale-width</property>
+                          </object>
+                          <packing>
+                            <property name="x_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label6">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">He_ight:</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">scale-height</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                            <property name="x_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkHBox" id="hbox2">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">2</property>
+                            <child>
+                              <object class="GtkHScale" id="scale-width">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">dropdown-width</property>
+                                <property name="round_digits">0</property>
+                                <property name="digits">0</property>
+                                <property name="value_pos">right</property>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label7">
+                                <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">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkHBox" id="hbox3">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">2</property>
+                            <child>
+                              <object class="GtkHScale" id="scale-height">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">dropdown-height</property>
+                                <property name="round_digits">0</property>
+                                <property name="digits">0</property>
+                                <property name="value_pos">right</property>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label12">
+                                <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">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">1</property>
+                            <property name="bottom_attach">2</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="label13">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">_Opacity:</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">scale-opacity</property>
+                          </object>
+                          <packing>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
+                            <property name="x_options">GTK_FILL</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkHBox" id="hbox4">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">2</property>
+                            <child>
+                              <object class="GtkHScale" id="scale-opacity">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">dropdown-opacity</property>
+                                <property name="round_digits">0</property>
+                                <property name="digits">0</property>
+                                <property name="value_pos">right</property>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label14">
+                                <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">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="right_attach">2</property>
+                            <property name="top_attach">2</property>
+                            <property name="bottom_attach">3</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label4">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Appearance</property>
+                    <property name="use_markup">True</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkFrame" id="frame3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkVBox" id="vbox3">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="border_width">6</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkHBox" id="hbox1">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="spacing">6</property>
+                            <child>
+                              <object class="GtkLabel" id="label10">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">L_eft</property>
+                                <property name="use_underline">True</property>
+                                <property name="mnemonic_widget">scale-position</property>
+                              </object>
+                              <packing>
+                                <property name="expand">False</property>
+                                <property name="fill">True</property>
+                                <property name="position">0</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkHScale" id="scale-position">
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="adjustment">dropdown-position</property>
+                                <property name="show_fill_level">True</property>
+                                <property name="digits">0</property>
+                                <property name="draw_value">False</property>
+                              </object>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">True</property>
+                                <property name="position">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="label11">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="xalign">1</property>
+                                <property name="label" translatable="yes">Right</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">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkCheckButton" id="dropdown-move-to-active">
+                            <property name="label" translatable="yes">Move to monitor with pointer</property>
+                            <property name="use_action_appearance">False</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">False</property>
+                            <property name="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label9">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Position</property>
+                    <property name="use_markup">True</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">button1</action-widget>
+      <action-widget response="0">button2</action-widget>
+    </action-widgets>
+  </object>
+  <object class="GtkAdjustment" id="dropdown-opacity">
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="dropdown-position">
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="dropdown-width">
+    <property name="lower">10</property>
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+</interface>
diff --git a/terminal/terminal-preferences.c b/terminal/terminal-preferences.c
index 26f6375..059ac88 100644
--- a/terminal/terminal-preferences.c
+++ b/terminal/terminal-preferences.c
@@ -61,6 +61,15 @@ enum
   PROP_COLOR_PALETTE,
   PROP_COMMAND_UPDATE_RECORDS,
   PROP_COMMAND_LOGIN_SHELL,
+  PROP_DROPDOWN_KEEP_OPEN_DEFAULT,
+  PROP_DROPDOWN_KEEP_ABOVE,
+  PROP_DROPDOWN_TOGGLE_FOCUS,
+  PROP_DROPDOWN_STATUS_ICON,
+  PROP_DROPDOWN_WIDTH,
+  PROP_DROPDOWN_HEIGHT,
+  PROP_DROPDOWN_OPACITY,
+  PROP_DROPDOWN_POSITION,
+  PROP_DROPDOWN_MOVE_TO_ACTIVE,
   PROP_ENCODING,
   PROP_FONT_ALLOW_BOLD,
   PROP_FONT_NAME,
@@ -480,11 +489,104 @@ terminal_preferences_class_init (TerminalPreferencesClass *klass)
                             G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
 
   /**
+   * TerminalPreferences:dropdown-keep-open-default:
+   **/
+  preferences_props[PROP_DROPDOWN_KEEP_OPEN_DEFAULT] =
+      g_param_spec_boolean ("dropdown-keep-open-default",
+                            NULL,
+                            "DropdownKeepOpenDefault",
+                            FALSE,
+                            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+
+  /**
+   * TerminalPreferences:dropdown-keep-above:
+   **/
+  preferences_props[PROP_DROPDOWN_KEEP_ABOVE] =
+      g_param_spec_boolean ("dropdown-keep-above",
+                            NULL,
+                            "DropdownKeepAbove",
+                            TRUE,
+                            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+
+  /**
+   * TerminalPreferences:dropdown-toggle-focus:
+   **/
+  preferences_props[PROP_DROPDOWN_TOGGLE_FOCUS] =
+      g_param_spec_boolean ("dropdown-toggle-focus",
+                            NULL,
+                            "DropdownToggleFocus",
+                            FALSE,
+                            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  /**
+   * TerminalPreferences:dropdown-status-icon:
+   **/
+  preferences_props[PROP_DROPDOWN_STATUS_ICON] =
+      g_param_spec_boolean ("dropdown-status-icon",
+                            NULL,
+                            "DropdownStatusIcon",
+                            TRUE,
+                            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+
+  /**
+   * TerminalPreferences:dropdown-width:
+   **/
+  preferences_props[PROP_DROPDOWN_WIDTH] =
+      g_param_spec_uint ("dropdown-width",
+                         NULL,
+                         "DropdownWidth",
+                         10, 100, 80,
+                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  /**
+   * TerminalPreferences:dropdown-height:
+   **/
+  preferences_props[PROP_DROPDOWN_HEIGHT] =
+      g_param_spec_uint ("dropdown-height",
+                         NULL,
+                         "DropdownHeight",
+                         10, 100, 50,
+                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  /**
+   * TerminalPreferences:dropdown-opacity:
+   **/
+  preferences_props[PROP_DROPDOWN_OPACITY] =
+      g_param_spec_uint ("dropdown-opacity",
+                         NULL,
+                         "DropdownOpacity",
+                         0, 100, 100,
+                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  /**
+   * TerminalPreferences:dropdown-position:
+   **/
+  preferences_props[PROP_DROPDOWN_POSITION] =
+      g_param_spec_uint ("dropdown-position",
+                         NULL,
+                         "DropdownPosition",
+                         0, 100, 0,
+                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  /**
+   * TerminalPreferences:move-to-active:
+   **/
+  preferences_props[PROP_DROPDOWN_MOVE_TO_ACTIVE] =
+      g_param_spec_boolean ("dropdown-move-to-active",
+                            NULL,
+                            "DropdownMoveToActive",
+                            TRUE,
+                            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
+
+  /**
    * TerminalPreferences:encoding:
    **/
   preferences_props[PROP_ENCODING] =
       g_param_spec_string ("encoding",
-                           "encodinge",
+                           NULL,
                            "Encoding",
                            NULL,
                            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
diff --git a/terminal/terminal-window-dropdown.c b/terminal/terminal-window-dropdown.c
index e02a5fa..7e0b9d4 100644
--- a/terminal/terminal-window-dropdown.c
+++ b/terminal/terminal-window-dropdown.c
@@ -43,22 +43,41 @@
 #include <terminal/terminal-window.h>
 #include <terminal/terminal-dialogs.h>
 #include <terminal/terminal-window-dropdown.h>
+#include <terminal/terminal-preferences-dropdown-dialog.h>
+
+
+
+enum
+{
+  PROP_0,
+  PROP_DROPDOWN_WIDTH,
+  PROP_DROPDOWN_HEIGHT,
+  PROP_DROPDOWN_POSITION,
+  PROP_DROPDOWN_OPACITY,
+  PROP_DROPDOWN_STATUS_ICON,
+  PROP_DROPDOWN_KEEP_ABOVE,
+  N_PROPERTIES
+};
 
 
 
 static void            terminal_window_dropdown_finalize                      (GObject                *object);
+static void            terminal_window_dropdown_set_property                  (GObject                *object,
+                                                                               guint                   prop_id,
+                                                                               const GValue           *value,
+                                                                               GParamSpec             *pspec);
 static gboolean        terminal_window_dropdown_focus_out_event               (GtkWidget              *widget,
                                                                                GdkEventFocus          *event);
-static void            terminal_window_dropdown_position                      (TerminalWindowDropdown *dropdown);
+static gboolean        terminal_window_dropdown_status_icon_press_event       (GtkStatusIcon          *status_icon,
+                                                                               GdkEventButton         *event,
+                                                                               TerminalWindowDropdown *dropdown);
+static void            terminal_window_dropdown_position                      (TerminalWindowDropdown *dropdown,
+                                                                               guint32                 timestamp);
+static void            terminal_window_dropdown_toggle_real                   (TerminalWindowDropdown *dropdown,
+                                                                               guint32                 timestamp);
 static void            terminal_window_dropdown_preferences                   (TerminalWindowDropdown *dropdown);
 
 
-typedef enum
-{
-  DROPDOWN_STATE_HIDDEN,
-  DROPDOWN_STATE_VISIBLE,
-}
-DropdownState;
 
 struct _TerminalWindowDropdownClass
 {
@@ -69,12 +88,23 @@ struct _TerminalWindowDropdown
 {
   TerminalWindow __parent__;
 
+  TerminalPreferences *preferences;
+
   /* ui widgets */
-  GtkWidget     *keep_open;
+  GtkWidget           *keep_open;
+
+  /* measurements */
+  gdouble              rel_width;
+  gdouble              rel_height;
+  gdouble              rel_position;
+
+  GtkWidget           *preferences_dialog;
 
-  /* size */
-  gdouble        rel_width;
-  gdouble        rel_height;
+  GtkStatusIcon       *status_icon;
+
+  /* last screen and monitor */
+  GdkScreen           *screen;
+  gint                 monitor_num;
 };
 
 
@@ -83,6 +113,10 @@ G_DEFINE_TYPE (TerminalWindowDropdown, terminal_window_dropdown, TERMINAL_TYPE_W
 
 
 
+static GParamSpec *dropdown_props[N_PROPERTIES] = { NULL, };
+
+
+
 static void
 terminal_window_dropdown_class_init (TerminalWindowDropdownClass *klass)
 {
@@ -90,10 +124,50 @@ terminal_window_dropdown_class_init (TerminalWindowDropdownClass *klass)
   GtkWidgetClass *gtkwidget_class;
 
   gobject_class = G_OBJECT_CLASS (klass);
+  gobject_class->set_property = terminal_window_dropdown_set_property;
   gobject_class->finalize = terminal_window_dropdown_finalize;
 
   gtkwidget_class = GTK_WIDGET_CLASS (klass);
   gtkwidget_class->focus_out_event = terminal_window_dropdown_focus_out_event;
+
+  dropdown_props[PROP_DROPDOWN_WIDTH] =
+      g_param_spec_uint ("dropdown-width",
+                         NULL, NULL,
+                         10, 100, 80,
+                         G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);
+
+  dropdown_props[PROP_DROPDOWN_HEIGHT] =
+      g_param_spec_uint ("dropdown-height",
+                         NULL, NULL,
+                         10, 100, 50,
+                         G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);
+
+  dropdown_props[PROP_DROPDOWN_POSITION] =
+      g_param_spec_uint ("dropdown-position",
+                         NULL, NULL,
+                         0, 100, 0,
+                         G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);
+
+  dropdown_props[PROP_DROPDOWN_OPACITY] =
+      g_param_spec_uint ("dropdown-opacity",
+                         NULL, NULL,
+                         0, 100, 100,
+                         G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);
+
+  dropdown_props[PROP_DROPDOWN_STATUS_ICON] =
+      g_param_spec_boolean ("dropdown-status-icon",
+                            NULL, NULL,
+                            TRUE,
+                            G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);
+
+  dropdown_props[PROP_DROPDOWN_KEEP_ABOVE] =
+      g_param_spec_boolean ("dropdown-keep-above",
+                            NULL, NULL,
+                            TRUE,
+                            G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);
+
+  /* install all properties */
+  g_object_class_install_properties (gobject_class, N_PROPERTIES, dropdown_props);
 }
 
 
@@ -106,20 +180,23 @@ terminal_window_dropdown_init (TerminalWindowDropdown *dropdown)
   GtkWidget      *hbox;
   GtkWidget      *button;
   GtkWidget      *img;
+  guint           n;
+  const gchar    *name;
+  gboolean        keep_open;
+
+  dropdown->preferences = terminal_preferences_get ();
+  dropdown->rel_width = 0.80;
+  dropdown->rel_height = 0.50;
+  dropdown->rel_position = 0.50;
 
   /* shared setting to disable some functionality in TerminalWindow */
   window->drop_down = TRUE;
 
-  dropdown->rel_width = 0.8;
-  dropdown->rel_height = 0.6;
-
   /* default window settings */
   gtk_window_set_resizable (GTK_WINDOW (dropdown), FALSE);
   gtk_window_set_decorated (GTK_WINDOW (dropdown), FALSE);
-  gtk_window_set_keep_above (GTK_WINDOW (dropdown), TRUE);
   gtk_window_set_gravity (GTK_WINDOW (dropdown), GDK_GRAVITY_STATIC);
-  gtk_window_set_type_hint  (GTK_WINDOW (dropdown), GDK_WINDOW_TYPE_HINT_DIALOG); /* avoid smart placement */
-  gtk_window_set_opacity (GTK_WINDOW (dropdown), 0.85);
+  gtk_window_set_type_hint  (GTK_WINDOW (dropdown), GDK_WINDOW_TYPE_HINT_DIALOG); /* avoids smart placement */
   gtk_window_stick (GTK_WINDOW (dropdown));
 
   /* this avoids to return focus to the window after dialog changes,
@@ -148,6 +225,9 @@ terminal_window_dropdown_init (TerminalWindowDropdown *dropdown)
   gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
   gtk_widget_show (button);
 
+  g_object_get (G_OBJECT (dropdown->preferences), "dropdown-keep-open-default", &keep_open, NULL);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), keep_open);
+
   img = gtk_image_new_from_stock (GTK_STOCK_GOTO_BOTTOM, GTK_ICON_SIZE_MENU);
   gtk_container_add (GTK_CONTAINER (button), img);
   gtk_widget_show (img);
@@ -164,6 +244,86 @@ terminal_window_dropdown_init (TerminalWindowDropdown *dropdown)
   img = gtk_image_new_from_stock (GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU);
   gtk_container_add (GTK_CONTAINER (button), img);
   gtk_widget_show (img);
+
+  /* connect bindings */
+  for (n = 1; n < N_PROPERTIES; n++)
+    {
+      name = g_param_spec_get_name (dropdown_props[n]);
+      g_object_bind_property (G_OBJECT (dropdown->preferences), name,
+                              G_OBJECT (dropdown), name,
+                              G_BINDING_SYNC_CREATE);
+    }
+}
+
+
+
+static void
+terminal_window_dropdown_set_property (GObject      *object,
+                                       guint         prop_id,
+                                       const GValue *value,
+                                       GParamSpec   *pspec)
+{
+  TerminalWindowDropdown *dropdown = TERMINAL_WINDOW_DROPDOWN (object);
+  gdouble                 opacity;
+  GdkScreen              *screen;
+
+  switch (prop_id)
+    {
+    case PROP_DROPDOWN_WIDTH:
+      dropdown->rel_width = g_value_get_uint (value) / 100.0;
+      break;
+
+    case PROP_DROPDOWN_HEIGHT:
+      dropdown->rel_height = g_value_get_uint (value) / 100.0;
+      break;
+
+    case PROP_DROPDOWN_POSITION:
+      dropdown->rel_position = g_value_get_uint (value) / 100.0;
+      break;
+
+    case PROP_DROPDOWN_OPACITY:
+      screen = gtk_window_get_screen (GTK_WINDOW (dropdown));
+      if (gdk_screen_is_composited (screen))
+        opacity = g_value_get_uint (value) / 100.0;
+      else
+        opacity = 1.00;
+
+      gtk_window_set_opacity (GTK_WINDOW (dropdown), opacity);
+      return;
+
+    case PROP_DROPDOWN_STATUS_ICON:
+      if (g_value_get_boolean (value))
+        {
+          if (dropdown->status_icon == NULL)
+            {
+              dropdown->status_icon = gtk_status_icon_new_from_icon_name ("utilities-terminal");
+              gtk_status_icon_set_name (dropdown->status_icon, PACKAGE_NAME);
+              gtk_status_icon_set_title (dropdown->status_icon, _("Drop-down Terminal"));
+              gtk_status_icon_set_tooltip_text (dropdown->status_icon, _("Toggle Drop-down Terminal"));
+              g_signal_connect (G_OBJECT (dropdown->status_icon), "button-press-event",
+                  G_CALLBACK (terminal_window_dropdown_status_icon_press_event), dropdown);
+            }
+        }
+      else if (dropdown->status_icon != NULL)
+        {
+          g_object_unref (G_OBJECT (dropdown->status_icon));
+          dropdown->status_icon = NULL;
+        }
+      return;
+
+    case PROP_DROPDOWN_KEEP_ABOVE:
+      gtk_window_set_keep_above (GTK_WINDOW (dropdown), g_value_get_boolean (value));
+      if (dropdown->preferences_dialog != NULL)
+        terminal_activate_window (GTK_WINDOW (dropdown->preferences_dialog));
+      return;
+
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+      return;
+    }
+
+  if (gtk_widget_get_visible (GTK_WIDGET (dropdown)))
+    terminal_window_dropdown_position (dropdown, 0);
 }
 
 
@@ -171,7 +331,12 @@ terminal_window_dropdown_init (TerminalWindowDropdown *dropdown)
 static void
 terminal_window_dropdown_finalize (GObject *object)
 {
-  //TerminalWindowDropdown *dropdown = TERMINAL_WINDOW_DROPDOWN (object);
+  TerminalWindowDropdown *dropdown = TERMINAL_WINDOW_DROPDOWN (object);
+
+  g_object_unref (dropdown->preferences);
+
+  if (dropdown->status_icon != NULL)
+    g_object_unref (G_OBJECT (dropdown->status_icon));
 
   (*G_OBJECT_CLASS (terminal_window_dropdown_parent_class)->finalize) (object);
 }
@@ -192,6 +357,7 @@ terminal_window_dropdown_focus_out_event (GtkWidget     *widget,
   /* check if keep open is not enabled */
   if (gtk_widget_get_visible (widget)
       && TERMINAL_WINDOW (dropdown)->n_child_windows == 0
+      && dropdown->preferences_dialog == NULL
       && gtk_grab_get_current () == NULL /* popup menu check */
       && !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dropdown->keep_open)))
     {
@@ -212,29 +378,47 @@ terminal_window_dropdown_focus_out_event (GtkWidget     *widget,
 
 
 
+static gboolean
+terminal_window_dropdown_status_icon_press_event (GtkStatusIcon          *status_icon,
+                                                  GdkEventButton         *event,
+                                                  TerminalWindowDropdown *dropdown)
+{
+  terminal_window_dropdown_toggle_real (dropdown, event->time);
+  return FALSE;
+}
+
+
+
 static void
-terminal_window_dropdown_position (TerminalWindowDropdown *dropdown)
+terminal_window_dropdown_position (TerminalWindowDropdown *dropdown,
+                                   guint32                 timestamp)
 {
   TerminalWindow *window = TERMINAL_WINDOW (dropdown);
   gint            w, h;
   GdkRectangle    monitor_geo;
   gint            x_dest, y_dest;
-  GdkScreen      *screen;
-  gint            monitor_num;
   gint            xpad, ypad;
   glong           char_width, char_height;
   GtkRequisition  req1, req2;
+  gboolean        move_to_active;
 
-  /* nothing to do if the window is hidden */
+  /* show window */
   if (!gtk_widget_get_visible (GTK_WIDGET (dropdown)))
-    return;
+    gtk_window_present_with_time (GTK_WINDOW (dropdown), timestamp);
+
+  g_object_get (G_OBJECT (dropdown->preferences),
+                "dropdown-move-to-active", &move_to_active, NULL);
+
+  if (move_to_active
+      || dropdown->screen == NULL
+      || dropdown->monitor_num == -1)
+    dropdown->screen = xfce_gdk_screen_get_active (&dropdown->monitor_num);
 
   /* get the active monitor size */
-  screen = xfce_gdk_screen_get_active (&monitor_num);
-  gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor_geo);
+  gdk_screen_get_monitor_geometry (dropdown->screen, dropdown->monitor_num, &monitor_geo);
 
   /* move window to correct screen */
-  gtk_window_set_screen (GTK_WINDOW (dropdown), screen);
+  gtk_window_set_screen (GTK_WINDOW (dropdown), dropdown->screen);
 
   /* calculate size */
   w = monitor_geo.width * dropdown->rel_width;
@@ -257,7 +441,7 @@ terminal_window_dropdown_position (TerminalWindowDropdown *dropdown)
   gtk_widget_set_size_request (window->notebook, w, h);
 
   /* calc position */
-  x_dest = monitor_geo.x + (monitor_geo.width - w) / 2;
+  x_dest = monitor_geo.x + (monitor_geo.width - w) * dropdown->rel_position;
   y_dest = monitor_geo.y;
 
   /* move */
@@ -267,9 +451,54 @@ terminal_window_dropdown_position (TerminalWindowDropdown *dropdown)
 
 
 static void
+terminal_window_dropdown_toggle_real (TerminalWindowDropdown *dropdown,
+                                      guint32                 timestamp)
+{
+  gboolean toggle_focus;
+
+  if (gtk_widget_get_visible (GTK_WIDGET (dropdown)))
+    {
+      g_object_get (G_OBJECT (dropdown->preferences), "dropdown-toggle-focus", &toggle_focus, NULL);
+
+      if (!toggle_focus)
+        {
+          /* hide */
+          gtk_widget_hide (GTK_WIDGET (dropdown));
+        }
+      else
+        {
+          terminal_window_dropdown_position (dropdown, timestamp);
+          terminal_activate_window (GTK_WINDOW (dropdown));
+        }
+    }
+  else
+    {
+      /* popup */
+      terminal_window_dropdown_position (dropdown, timestamp);
+    }
+}
+
+
+
+static void
 terminal_window_dropdown_preferences (TerminalWindowDropdown *dropdown)
 {
+  if (dropdown->preferences_dialog == NULL)
+    {
+      dropdown->preferences_dialog = terminal_preferences_dropdown_dialog_new ();
+      if (G_LIKELY (dropdown->preferences_dialog != NULL))
+        {
+          g_object_add_weak_pointer (G_OBJECT (dropdown->preferences_dialog),
+                                     (gpointer) &dropdown->preferences_dialog);
+        }
+    }
 
+  if (dropdown->preferences_dialog != NULL)
+    {
+      gtk_window_set_transient_for (GTK_WINDOW (dropdown->preferences_dialog), GTK_WINDOW (dropdown));
+      gtk_window_present (GTK_WINDOW (dropdown->preferences_dialog));
+      gtk_window_set_modal (GTK_WINDOW (dropdown->preferences_dialog), TRUE);
+    }
 }
 
 
@@ -317,20 +546,9 @@ terminal_window_dropdown_toggle (TerminalWindowDropdown *dropdown,
 {
   guint32 timestamp;
 
-  if (gtk_widget_get_visible (GTK_WIDGET (dropdown)))
-    {
-      /* hide */
-      gtk_widget_hide (GTK_WIDGET (dropdown));
-    }
-  else
-    {
-      /* show with event time */
-      timestamp = terminal_window_dropdown_get_timestamp (GTK_WIDGET (dropdown), startup_id);
-      gtk_window_present_with_time (GTK_WINDOW (dropdown), timestamp);
-
-      /* check position */
-      terminal_window_dropdown_position (dropdown);
-    }
+  /* toggle window */
+  timestamp = terminal_window_dropdown_get_timestamp (GTK_WIDGET (dropdown), startup_id);
+  terminal_window_dropdown_toggle_real (dropdown, timestamp);
 
   /* window is focussed or hidden */
   if (startup_id != NULL)
diff --git a/terminal/terminal-window.c b/terminal/terminal-window.c
index b644002..245036d 100644
--- a/terminal/terminal-window.c
+++ b/terminal/terminal-window.c
@@ -1369,26 +1369,21 @@ static void
 terminal_window_action_prefs (GtkAction      *action,
                               TerminalWindow *window)
 {
-  /* check if we already have a preferences dialog instance */
-  if (G_UNLIKELY (window->preferences_dialog != NULL))
+  if (window->preferences_dialog == NULL)
     {
-      /* move to the current screen and make transient for this window */
-      gtk_window_set_screen (GTK_WINDOW (window->preferences_dialog), gtk_widget_get_screen (GTK_WIDGET (window)));
-      gtk_window_set_transient_for (GTK_WINDOW (window->preferences_dialog), GTK_WINDOW (window));
-
-      /* present the preferences dialog on the current workspace */
-      gtk_window_present (GTK_WINDOW (window->preferences_dialog));
-    }
-  else
-    {
-      /* allocate a new preferences dialog instance */
-      window->preferences_dialog = terminal_preferences_dialog_new (GTK_WINDOW (window));
+      window->preferences_dialog = terminal_preferences_dialog_new ();
       if (G_LIKELY (window->preferences_dialog != NULL))
         {
-          g_object_add_weak_pointer (G_OBJECT (window->preferences_dialog), (gpointer) &window->preferences_dialog);
-          gtk_widget_show (window->preferences_dialog);
+          g_object_add_weak_pointer (G_OBJECT (window->preferences_dialog),
+                                     (gpointer) &window->preferences_dialog);
         }
     }
+
+  if (window->preferences_dialog != NULL)
+    {
+      gtk_window_set_transient_for (GTK_WINDOW (window->preferences_dialog), GTK_WINDOW (window));
+      gtk_window_present (GTK_WINDOW (window->preferences_dialog));
+    }
 }
 
 


More information about the Xfce4-commits mailing list