summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--capplets/keybindings/mate-keybinding-properties.c31
-rw-r--r--capplets/keybindings/mate-keybinding-properties.ui74
2 files changed, 93 insertions, 12 deletions
diff --git a/capplets/keybindings/mate-keybinding-properties.c b/capplets/keybindings/mate-keybinding-properties.c
index 9d548569..78900537 100644
--- a/capplets/keybindings/mate-keybinding-properties.c
+++ b/capplets/keybindings/mate-keybinding-properties.c
@@ -1828,6 +1828,30 @@ selection_changed (GtkTreeSelection *selection, gpointer data)
}
static void
+cb_app_dialog_response (GtkWidget *dialog, gint response_id, gpointer data)
+{
+ if (response_id == GTK_RESPONSE_OK)
+ {
+ GAppInfo *info;
+ const gchar *custom_name;
+
+ info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (dialog));
+
+ gtk_entry_set_text (custom_shortcut_command_entry,
+ g_app_info_get_executable (info));
+ /* if name isn't set yet, use the associated one */
+ custom_name = gtk_entry_get_text (GTK_ENTRY (custom_shortcut_name_entry));
+ if (! custom_name || custom_name[0] == '\0')
+ gtk_entry_set_text (custom_shortcut_name_entry,
+ g_app_info_get_display_name (info));
+
+ g_object_unref (info);
+ }
+
+ gtk_widget_hide (dialog);
+}
+
+static void
setup_dialog (GtkBuilder *builder, GSettings *marco_settings)
{
GtkCellRenderer *renderer;
@@ -1835,6 +1859,7 @@ setup_dialog (GtkBuilder *builder, GSettings *marco_settings)
GtkWidget *widget;
GtkTreeView *treeview;
GtkTreeSelection *selection;
+ GtkWidget *button;
treeview = GTK_TREE_VIEW (gtk_builder_get_object (builder,
"shortcut_treeview"));
@@ -1916,6 +1941,12 @@ setup_dialog (GtkBuilder *builder, GSettings *marco_settings)
GTK_RESPONSE_OK);
gtk_window_set_transient_for (GTK_WINDOW (custom_shortcut_dialog),
GTK_WINDOW (widget));
+ button = _gtk_builder_get_widget (builder, "custom-shortcut-command-button");
+ widget = _gtk_builder_get_widget (builder, "custom-shortcut-application-dialog");
+ g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_dialog_run), widget);
+ g_signal_connect (widget, "response", G_CALLBACK (cb_app_dialog_response), NULL);
+ widget = gtk_app_chooser_dialog_get_widget (GTK_APP_CHOOSER_DIALOG (widget));
+ gtk_app_chooser_widget_set_show_all (GTK_APP_CHOOSER_WIDGET (widget), TRUE);
}
static void
diff --git a/capplets/keybindings/mate-keybinding-properties.ui b/capplets/keybindings/mate-keybinding-properties.ui
index 2eae2c1d..65ed5059 100644
--- a/capplets/keybindings/mate-keybinding-properties.ui
+++ b/capplets/keybindings/mate-keybinding-properties.ui
@@ -100,29 +100,53 @@
</packing>
</child>
<child>
- <object class="GtkEntry" id="custom-shortcut-command-entry">
+ <object class="GtkLabel" id="label14">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hexpand">True</property>
- <property name="invisible_char">•</property>
- <property name="activates_default">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="label" translatable="yes">C_ommand:</property>
+ <property name="use_underline">True</property>
</object>
<packing>
- <property name="left_attach">1</property>
+ <property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="label14">
+ <object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="halign">start</property>
- <property name="label" translatable="yes">C_ommand:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">custom-shortcut-command-entry</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkEntry" id="custom-shortcut-command-entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hexpand">True</property>
+ <property name="invisible_char">•</property>
+ <property name="activates_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="custom-shortcut-command-button">
+ <property name="label" translatable="yes">Browse applications...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">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="left_attach">0</property>
+ <property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
@@ -147,6 +171,32 @@
<action-widget response="-5">okbutton1</action-widget>
</action-widgets>
</object>
+ <object class="GtkAppChooserDialog" id="custom-shortcut-application-dialog">
+ <property name="can_focus">False</property>
+ <property name="modal">True</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="type_hint">dialog</property>
+ <property name="transient_for">custom-shortcut-dialog</property>
+ <property name="content_type">*/*</property>
+ <child internal-child="vbox">
+ <object class="GtkBox">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox">
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
<object class="GtkDialog" id="mate-keybinding-dialog">
<property name="name">mate-keybinding-dialog</property>
<property name="can_focus">False</property>