Updating branch refs/heads/master to f609df3f73f1e7a4c7659b2b20ed3e043aa9f2e7 (commit) from 17d3d97874eb9c764669f5499ad5b4468506ade4 (commit)
commit f609df3f73f1e7a4c7659b2b20ed3e043aa9f2e7 Author: Jérôme Guelfucci <jero...@xfce.org> Date: Sat Dec 29 14:42:55 2012 +0100 Add an Edit button and improve the buttons' layout. settings-dialogs/xfwm4-dialog.glade | 85 ++++++++++++++++++++++------------- settings-dialogs/xfwm4-settings.c | 58 ++++++++++++++++++++++++ 2 files changed, 112 insertions(+), 31 deletions(-) diff --git a/settings-dialogs/xfwm4-dialog.glade b/settings-dialogs/xfwm4-dialog.glade index 97b1189..d623b7b 100644 --- a/settings-dialogs/xfwm4-dialog.glade +++ b/settings-dialogs/xfwm4-dialog.glade @@ -544,46 +544,69 @@ </packing> </child> <child> - <object class="GtkHButtonBox" id="hbuttonbox1"> + <object class="GtkAlignment" id="alignment15"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="spacing">12</property> - <property name="layout_style">center</property> + <property name="yalign">0</property> + <property name="xscale">0</property> <child> - <object class="GtkButton" id="shortcuts_clear_button"> - <property name="label">gtk-clear</property> - <property name="use_action_appearance">False</property> + <object class="GtkHBox" id="hbox5"> <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> - </packing> - </child> - <child> - <object class="GtkButton" id="shortcuts_reset_button"> - <property name="label" translatable="yes">_Reset to Defaults</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_underline">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkButton" id="shortcuts_edit_button"> + <property name="label">gtk-edit</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> + </packing> + </child> + <child> + <object class="GtkButton" id="shortcuts_clear_button"> + <property name="label">gtk-clear</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> + <child> + <object class="GtkButton" id="shortcuts_reset_button"> + <property name="label" translatable="yes">_Reset to Defaults</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_underline">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="padding">15</property> + <property name="pack_type">end</property> + <property name="position">2</property> + </packing> + </child> </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="pack_type">end</property> - <property name="position">1</property> - </packing> </child> </object> <packing> <property name="expand">False</property> - <property name="fill">True</property> + <property name="fill">False</property> <property name="position">1</property> </packing> </child> diff --git a/settings-dialogs/xfwm4-settings.c b/settings-dialogs/xfwm4-settings.c index 1b5b7e9..88cc9d5 100644 --- a/settings-dialogs/xfwm4-settings.c +++ b/settings-dialogs/xfwm4-settings.c @@ -175,6 +175,8 @@ static void xfwm_settings_shortcut_added (XfceShortc static void xfwm_settings_shortcut_removed (XfceShortcutsProvider *provider, const gchar *shortcut, XfwmSettings *settings); +static void xfwm_settings_shortcut_edit_clicked (GtkButton *button, + XfwmSettings *settings); static void xfwm_settings_shortcut_clear_clicked (GtkButton *button, XfwmSettings *settings); static void xfwm_settings_shortcut_reset_clicked (GtkButton *button, @@ -326,6 +328,7 @@ xfwm_settings_constructed (GObject *object) GtkWidget *hidden_frame; GtkWidget *hidden_box; GtkWidget *shortcuts_treeview; + GtkWidget *shortcuts_edit_button; GtkWidget *shortcuts_clear_button; GtkWidget *shortcuts_reset_button; GtkWidget *focus_delay_scale; @@ -498,6 +501,8 @@ xfwm_settings_constructed (GObject *object) /* Keyboard tab widgets */ shortcuts_treeview = GTK_WIDGET (gtk_builder_get_object (settings->priv->builder, "shortcuts_treeview")); + shortcuts_edit_button = GTK_WIDGET (gtk_builder_get_object (settings->priv->builder, + "shortcuts_edit_button")); shortcuts_clear_button = GTK_WIDGET (gtk_builder_get_object (settings->priv->builder, "shortcuts_clear_button")); shortcuts_reset_button = GTK_WIDGET (gtk_builder_get_object (settings->priv->builder, @@ -532,6 +537,8 @@ xfwm_settings_constructed (GObject *object) } /* Connect to shortcut buttons */ + g_signal_connect (shortcuts_edit_button, "clicked", + G_CALLBACK (xfwm_settings_shortcut_edit_clicked), settings); g_signal_connect (shortcuts_clear_button, "clicked", G_CALLBACK (xfwm_settings_shortcut_clear_clicked), settings); g_signal_connect (shortcuts_reset_button, "clicked", @@ -1754,6 +1761,57 @@ xfwm_settings_shortcut_removed (XfceShortcutsProvider *provider, static void +xfwm_settings_shortcut_edit_clicked (GtkButton *button, + XfwmSettings *settings) +{ + GtkTreeSelection *selection; + GtkTreeModel *model; + GtkTreePath *path; + GtkTreeIter tree_iter; + GtkWidget *view; + GList *rows; + GList *iter; + GList *row_references = NULL; + gchar *shortcut; + + g_return_if_fail (XFWM_IS_SETTINGS (settings)); + g_return_if_fail (GTK_IS_BUILDER (settings->priv->builder)); + g_return_if_fail (XFCE_IS_SHORTCUTS_PROVIDER (settings->priv->provider)); + + view = GTK_WIDGET (gtk_builder_get_object (settings->priv->builder, "shortcuts_treeview")); + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (view)); + rows = gtk_tree_selection_get_selected_rows (selection, &model); + + for (iter = g_list_first (rows); iter != NULL; iter = g_list_next (iter)) + { + row_references = g_list_append (row_references, + gtk_tree_row_reference_new (model, iter->data)); + } + + for (iter = g_list_first (row_references); iter != NULL; iter = g_list_next (iter)) + { + path = gtk_tree_row_reference_get_path (iter->data); + + /* Use the row-activated callback to manage the shortcut editing */ + xfwm_settings_shortcut_row_activated (GTK_TREE_VIEW (view), + path, NULL, + settings); + + gtk_tree_path_free (path); + } + + /* Free row reference list */ + g_list_foreach (row_references, (GFunc) gtk_tree_row_reference_free, NULL); + g_list_free (row_references); + + /* Free row list */ + g_list_foreach (rows, (GFunc) gtk_tree_path_free, NULL); + g_list_free (rows); +} + + + +static void xfwm_settings_shortcut_clear_clicked (GtkButton *button, XfwmSettings *settings) { _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits