[Xfce4-commits] <xfce4-panel:devel> Merge branch 'devel' of ssh://git.xfce.org/git/xfce/xfce4-panel into devel
Nick Schermer
noreply at xfce.org
Sun Feb 14 23:06:03 CET 2010
Updating branch refs/heads/devel
to 33cc0f4d45d68610cc2cdaaec362d2822bcd9d38 (commit)
from 6ba92f016a5a153eff77a64bf5ef40b6db7d39c8 (commit)
commit 33cc0f4d45d68610cc2cdaaec362d2822bcd9d38
Merge: 6ba92f016a5a153eff77a64bf5ef40b6db7d39c8 21391e7631f15948fb972e17500f992683283ab1
Author: Nick Schermer <nick at xfce.org>
Date: Sun Feb 7 22:21:45 2010 +0100
Merge branch 'devel' of ssh://git.xfce.org/git/xfce/xfce4-panel into devel
commit 21391e7631f15948fb972e17500f992683283ab1
Author: Jannis Pohlmann <jannis at xfce.org>
Date: Sun Feb 7 17:30:29 2010 +0100
Add missing semicolon.
commit 5ef9da15ed8353f7463f6ec1141f5cf2cdc5f3a4
Author: Nick Schermer <nick at xfce.org>
Date: Sun Feb 7 16:38:37 2010 +0100
Allow double-click on treeview item for editing and adding.
commit 21a3cca1d039c9150d3647102db608425e861c4b
Author: Nick Schermer <nick at xfce.org>
Date: Sat Feb 6 22:05:42 2010 +0100
Fix preferences dialog sensitivity.
panel/panel-preferences-dialog.c | 65 +++++++++++++++++++++---------------
plugins/launcher/launcher-dialog.c | 62 ++++++++++++++++++++++++++++++++++
2 files changed, 100 insertions(+), 27 deletions(-)
diff --git a/panel/panel-preferences-dialog.c b/panel/panel-preferences-dialog.c
index bcb7482..d93b84b 100644
--- a/panel/panel-preferences-dialog.c
+++ b/panel/panel-preferences-dialog.c
@@ -525,13 +525,45 @@ panel_preferences_dialog_output_changed (GtkComboBox *combobox,
static void
+panel_preferences_dialog_panel_sensitive (PanelPreferencesDialog *dialog)
+{
+
+ GObject *object;
+ gboolean locked = TRUE;
+ gint n_windows;
+
+ panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog));
+
+ if (G_LIKELY (dialog->active != NULL))
+ locked = panel_window_get_locked (dialog->active);
+
+ object = gtk_builder_get_object (GTK_BUILDER (dialog), "panel-remove");
+ panel_return_if_fail (GTK_IS_WIDGET (object));
+ n_windows = panel_application_get_n_windows (dialog->application);
+ gtk_widget_set_sensitive (GTK_WIDGET (object), !locked && n_windows > 1);
+
+ object = gtk_builder_get_object (GTK_BUILDER (dialog), "panel-add");
+ panel_return_if_fail (GTK_IS_WIDGET (object));
+ gtk_widget_set_sensitive (GTK_WIDGET (object),
+ !panel_application_get_locked (dialog->application));
+
+ object = gtk_builder_get_object (GTK_BUILDER (dialog), "notebook");
+ panel_return_if_fail (GTK_IS_WIDGET (object));
+ gtk_widget_set_sensitive (GTK_WIDGET (object), !locked);
+
+ object = gtk_builder_get_object (GTK_BUILDER (dialog), "item-add");
+ panel_return_if_fail (GTK_IS_WIDGET (object));
+ gtk_widget_set_sensitive (GTK_WIDGET (object), !locked);
+}
+
+
+
+static void
panel_preferences_dialog_panel_combobox_changed (GtkComboBox *combobox,
PanelPreferencesDialog *dialog)
{
gint nth;
GtkWidget *itembar;
- GObject *object;
- gboolean locked = TRUE;
panel_return_if_fail (GTK_IS_COMBO_BOX (combobox));
panel_return_if_fail (PANEL_IS_PREFERENCES_DIALOG (dialog));
@@ -561,23 +593,9 @@ panel_preferences_dialog_panel_combobox_changed (GtkComboBox *combobo
/* update the items treeview */
panel_preferences_dialog_item_store_rebuild (itembar, dialog);
-
- /* make the entire notebook insensitive when the window is locked */
- locked = panel_window_get_locked (dialog->active);
- object = gtk_builder_get_object (GTK_BUILDER (dialog), "notebook");
- panel_return_if_fail (GTK_IS_WIDGET (object));
- gtk_widget_set_sensitive (GTK_WIDGET (object), !locked);
}
- /* sensitivity of the remove button */
- object = gtk_builder_get_object (GTK_BUILDER (dialog), "panel-remove");
- panel_return_if_fail (GTK_IS_WIDGET (object));
- gtk_widget_set_sensitive (GTK_WIDGET (object), !locked);
-
- /* sensitivity of the add button in item tab */
- object = gtk_builder_get_object (GTK_BUILDER (dialog), "item-add");
- panel_return_if_fail (GTK_IS_WIDGET (object));
- gtk_widget_set_sensitive (GTK_WIDGET (object), !!(dialog->active != NULL));
+ panel_preferences_dialog_panel_sensitive (dialog);
}
@@ -585,7 +603,7 @@ panel_preferences_dialog_panel_combobox_changed (GtkComboBox *combobo
static void
panel_preferences_dialog_panel_combobox_rebuild (PanelPreferencesDialog *dialog)
{
- GObject *store, *combo, *object;
+ GObject *store, *combo;
gint n, n_items;
gchar *name;
@@ -612,18 +630,11 @@ panel_preferences_dialog_panel_combobox_rebuild (PanelPreferencesDialog *dialog)
g_free (name);
}
- /* set sensitivity of some widgets */
- object = gtk_builder_get_object (GTK_BUILDER (dialog), "notebook");
- panel_return_if_fail (GTK_IS_WIDGET (object));
- gtk_widget_set_sensitive (GTK_WIDGET (object), !!(n_items > 0));
-
- object = gtk_builder_get_object (GTK_BUILDER (dialog), "panel-remove");
- panel_return_if_fail (GTK_IS_WIDGET (object));
- gtk_widget_set_sensitive (GTK_WIDGET (object), !!(n_items > 1));
-
/* unblock signal */
g_signal_handlers_unblock_by_func (combo,
panel_preferences_dialog_panel_combobox_changed, dialog);
+
+ panel_preferences_dialog_panel_sensitive (dialog);
}
diff --git a/plugins/launcher/launcher-dialog.c b/plugins/launcher/launcher-dialog.c
index 6127d7e..8fa8d48 100644
--- a/plugins/launcher/launcher-dialog.c
+++ b/plugins/launcher/launcher-dialog.c
@@ -292,6 +292,35 @@ launcher_dialog_add_selection_changed (GtkTreeSelection *selection,
+static gboolean
+launcher_dialog_add_button_press_event (GtkTreeView *treeview,
+ GdkEventButton *event,
+ LauncherPluginDialog *dialog)
+{
+ GObject *object;
+
+ panel_return_val_if_fail (GTK_IS_BUILDER (dialog->builder), FALSE);
+ panel_return_val_if_fail (GTK_IS_TREE_VIEW (treeview), FALSE);
+
+ if (event->button == 1 && event->type == GDK_2BUTTON_PRESS
+ && event->window == gtk_tree_view_get_bin_window (treeview)
+ && gtk_tree_view_get_path_at_pos (treeview, event->x, event->y,
+ NULL, NULL, NULL, NULL))
+ {
+ object = gtk_builder_get_object (dialog->builder, "button-add");
+ panel_return_val_if_fail (GTK_IS_BUTTON (object), FALSE);
+ if (gtk_widget_get_sensitive (GTK_WIDGET (object)))
+ {
+ gtk_button_clicked (GTK_BUTTON (object));
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+
+
static void
launcher_dialog_add_response (GtkWidget *widget,
gint response_id,
@@ -551,6 +580,35 @@ launcher_dialog_tree_selection_changed (GtkTreeSelection *selection,
+static gboolean
+launcher_dialog_tree_button_press_event (GtkTreeView *treeview,
+ GdkEventButton *event,
+ LauncherPluginDialog *dialog)
+{
+ GObject *object;
+
+ panel_return_val_if_fail (GTK_IS_BUILDER (dialog->builder), FALSE);
+ panel_return_val_if_fail (GTK_IS_TREE_VIEW (treeview), FALSE);
+
+ if (event->button == 1 && event->type == GDK_2BUTTON_PRESS
+ && event->window == gtk_tree_view_get_bin_window (treeview)
+ && gtk_tree_view_get_path_at_pos (treeview, event->x, event->y,
+ NULL, NULL, NULL, NULL))
+ {
+ object = gtk_builder_get_object (dialog->builder, "item-edit");
+ panel_return_val_if_fail (GTK_IS_BUTTON (object), FALSE);
+ if (gtk_widget_get_sensitive (GTK_WIDGET (object)))
+ {
+ gtk_button_clicked (GTK_BUTTON (object));
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+
+
static void
launcher_dialog_item_button_clicked (GtkWidget *button,
LauncherPluginDialog *dialog)
@@ -931,6 +989,8 @@ launcher_dialog_show (LauncherPlugin *plugin)
g_signal_connect (G_OBJECT (selection), "changed",
G_CALLBACK (launcher_dialog_tree_selection_changed), dialog);
launcher_dialog_tree_selection_changed (selection, dialog);
+ g_signal_connect (G_OBJECT (object), "button-press-event",
+ G_CALLBACK (launcher_dialog_tree_button_press_event), dialog);
/* connect bindings to the advanced properties */
for (i = 0; i < G_N_ELEMENTS (binding_names); i++)
@@ -963,6 +1023,8 @@ launcher_dialog_show (LauncherPlugin *plugin)
gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE);
g_signal_connect (G_OBJECT (selection), "changed",
G_CALLBACK (launcher_dialog_add_selection_changed), dialog);
+ g_signal_connect (G_OBJECT (object), "button-press-event",
+ G_CALLBACK (launcher_dialog_add_button_press_event), dialog);
/* setup search filter in the add dialog */
object = gtk_builder_get_object (builder, "add-store-filter");
More information about the Xfce4-commits
mailing list