summarylogtreecommitdiffstats
path: root/popovers__file-chooser-list.patch
blob: ff95bf79c8c46ff83084cfe2e305102fbe15dc57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
Index: src/gtk+-3.24.13/gtk/gtkfilechooserwidget.c
===================================================================
--- src.orig/gtk+-3.24.13/gtk/gtkfilechooserwidget.c
+++ src/gtk+-3.24.13/gtk/gtkfilechooserwidget.c
@@ -29,6 +29,7 @@
 #include "gtkcellrendererpixbuf.h"
 #include "gtkcellrenderertext.h"
 #include "gtkcheckmenuitem.h"
+#include "deprecated/gtkimagemenuitem.h"
 #include "gtkclipboard.h"
 #include "gtkcomboboxtext.h"
 #include "gtkdragsource.h"
@@ -2268,15 +2269,9 @@ append_separator (GtkWidget *box)
 {
   GtkWidget *separator;
 
-  separator = g_object_new (GTK_TYPE_SEPARATOR,
-                            "orientation", GTK_ORIENTATION_HORIZONTAL,
-                            "visible", TRUE,
-                            "margin-start", 12,
-                            "margin-end", 12,
-                            "margin-top", 6,
-                            "margin-bottom", 6,
-                            NULL);
-  gtk_container_add (GTK_CONTAINER (box), separator);
+  separator = gtk_separator_menu_item_new ();
+  gtk_widget_set_visible (GTK_WIDGET (separator), TRUE);
+  gtk_menu_shell_append (GTK_MENU_SHELL (box), separator);
 
   return separator;
 }
@@ -2289,12 +2294,14 @@ add_button (GtkWidget   *box,
 {
   GtkWidget *item;
 
- item = g_object_new (GTK_TYPE_MODEL_BUTTON,
-                       "visible", TRUE,
-                       "action-name", action,
-                       "text", label,
-                       NULL);
-  gtk_container_add (GTK_CONTAINER (box), item);
+  if (g_str_match_string ("toggle", action, TRUE))
+    item = gtk_check_menu_item_new_with_mnemonic (label);
+  else
+    item = gtk_image_menu_item_new_with_mnemonic (label);
+
+  g_object_set (G_OBJECT (item), "action-name", action, NULL);
+  gtk_widget_set_visible (GTK_WIDGET (item), TRUE);
+  gtk_menu_shell_append (GTK_MENU_SHELL (box), item);
 
   return item;
 }
@@ -2308,11 +2315,9 @@ file_list_build_popover (GtkFileChooserW
   if (priv->browse_files_popover)
     return;
 
-  priv->browse_files_popover = gtk_popover_new (priv->browse_files_tree_view);
-  box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-  g_object_set (box, "margin", 10, NULL);
-  gtk_widget_show (box);
-  gtk_container_add (GTK_CONTAINER (priv->browse_files_popover), box);
+  priv->browse_files_popover = gtk_menu_new ();
+  gtk_menu_attach_to_widget (GTK_MENU (priv->browse_files_popover), GTK_WIDGET (priv->browse_files_tree_view), NULL);
+  box = priv->browse_files_popover;
 
   priv->visit_file_item = add_button (box, _("_Visit File"), "item.visit");
   priv->open_folder_item = add_button (box, _("_Open With File Manager"), "item.open");
@@ -2329,6 +2334,12 @@ file_list_build_popover (GtkFileChooserW
   priv->type_column_item = add_button (box, _("Show T_ype Column"), "item.toggle-show-type");
   priv->show_time_item = add_button (box, _("Show _Time"), "item.toggle-show-time");
   priv->sort_directories_item = add_button (box, _("Sort _Folders before Files"), "item.toggle-sort-dirs-first");
+  g_object_set (priv->visit_file_item,         "image", gtk_image_new_from_icon_name ("gtk-jump-to",    GTK_ICON_SIZE_MENU), NULL);
+  g_object_set (priv->open_folder_item,        "image", gtk_image_new_from_icon_name ("gtk-open",       GTK_ICON_SIZE_MENU), NULL);
+  g_object_set (priv->copy_file_location_item, "image", gtk_image_new_from_icon_name ("gtk-copy",       GTK_ICON_SIZE_MENU), NULL);
+  g_object_set (priv->add_shortcut_item,       "image", gtk_image_new_from_icon_name ("gtk-add",        GTK_ICON_SIZE_MENU), NULL);
+  g_object_set (priv->delete_file_item,        "image", gtk_image_new_from_icon_name ("gtk-delete",     GTK_ICON_SIZE_MENU), NULL);
+  g_object_set (priv->trash_file_item,         "image", gtk_image_new_from_icon_name ("user-trash-full",GTK_ICON_SIZE_MENU), NULL);
 }
 
 /* Updates the popover for the file list, creating it if necessary */