[PATCH] Fix Can't remove icon from custom action (bug #8139)
Ondrej Kulaty
kulaty.o at gmail.com
Fri Apr 19 22:58:35 CEST 2013
---
plugins/thunar-uca/thunar-uca-editor.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/plugins/thunar-uca/thunar-uca-editor.c b/plugins/thunar-uca/thunar-uca-editor.c
index ea32a46..29b7bc6 100644
--- a/plugins/thunar-uca/thunar-uca-editor.c
+++ b/plugins/thunar-uca/thunar-uca-editor.c
@@ -44,6 +44,7 @@ static void thunar_uca_editor_set_types (ThunarUcaEditor
ThunarUcaTypes types);
static void thunar_uca_editor_command_clicked (ThunarUcaEditor *uca_editor);
static void thunar_uca_editor_icon_clicked (ThunarUcaEditor *uca_editor);
+static void thunar_uca_editor_remove_icon_clicked (ThunarUcaEditor *uca_editor);
@@ -59,6 +60,7 @@ struct _ThunarUcaEditor
GtkWidget *name_entry;
GtkWidget *description_entry;
GtkWidget *icon_button;
+ GtkWidget *remove_icon_button;
GtkWidget *command_entry;
GtkWidget *sn_button;
GtkWidget *parameter_entry;
@@ -239,6 +241,18 @@ thunar_uca_editor_init (ThunarUcaEditor *uca_editor)
gtk_table_attach (GTK_TABLE (table), hbox, 0, 2, 6, 7, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (hbox);
+ /* remove icon button */
+ align = gtk_alignment_new (0.35f, 0.5f, 0.0f, 0.0f);
+ gtk_table_attach (GTK_TABLE (table), align, 1, 2, 4, 5, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
+ gtk_widget_show (align);
+
+ uca_editor->remove_icon_button = gtk_button_new_with_label (_("Remove icon"));
+ gtk_widget_set_tooltip_text (uca_editor->remove_icon_button, _("Click this button to remove the icon."));
+ gtk_container_add (GTK_CONTAINER (align), uca_editor->remove_icon_button);
+ g_signal_connect_swapped (G_OBJECT (uca_editor->remove_icon_button), "clicked", G_CALLBACK (thunar_uca_editor_remove_icon_clicked), uca_editor);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (label), uca_editor->remove_icon_button);
+ gtk_widget_show (uca_editor->remove_icon_button);
+
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_DND);
gtk_misc_set_alignment (GTK_MISC (image), 0.5f, 0.0f);
gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
@@ -635,6 +649,14 @@ thunar_uca_editor_icon_clicked (ThunarUcaEditor *uca_editor)
+static void
+thunar_uca_editor_remove_icon_clicked (ThunarUcaEditor *uca_editor)
+{
+ thunar_uca_editor_set_icon_name (uca_editor, NULL);
+}
+
+
+
static const gchar*
thunar_uca_editor_get_icon_name (const ThunarUcaEditor *uca_editor)
{
@@ -674,6 +696,9 @@ thunar_uca_editor_set_icon_name (ThunarUcaEditor *uca_editor,
/* release the icon */
g_object_unref (G_OBJECT (icon));
+
+ /* show remove icon button */
+ gtk_widget_show (uca_editor->remove_icon_button);
}
else
{
@@ -684,6 +709,9 @@ thunar_uca_editor_set_icon_name (ThunarUcaEditor *uca_editor,
label = gtk_label_new (_("No icon"));
gtk_container_add (GTK_CONTAINER (uca_editor->icon_button), label);
gtk_widget_show (label);
+
+ /* hide remove icon button */
+ gtk_widget_hide (uca_editor->remove_icon_button);
}
}
--
1.8.2.1
More information about the Xfce4-dev
mailing list