~ubuntu-branches/ubuntu/raring/nautilus/raring

« back to all changes in this revision

Viewing changes to libnautilus-private/nautilus-ui-utilities.c

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher, Jeremy Bicha
  • Date: 2012-01-31 13:45:01 UTC
  • mfrom: (1.17.25)
  • Revision ID: package-import@ubuntu.com-20120131134501-yn7mqny7fgzx9fao
Tags: 1:3.3.4-0ubuntu1
* New upstream version which fixes:
  - "Opening Popupmenu in Context of Folder with List-View impossible?"
    (lp: #126540)
  - "'Create folder in here' context menu option for nautilus" (lp: #61786)
  - the file count and the size count change in opposite direction.
    (lp: #503330)
  - the mounts in the place menu should have a properties entry.
    (lp: #846289)
  - add command line option to select file (lp: #575719)
  - Media in 'Places' side bar should have same context menu as in 
    'Computer' (lp: #230098)
* debian/nautilus-data.install:
  - updated, ui and icons have been moved into gresources
* debian/patches/05_desktop_menu_export.patch:
   - updated to correctly include the gresources desktop definition

[ Jeremy Bicha ]
* New upstream release.
* debian/control.in:
  - Bump minimum GTK and glib
* Refreshed patches
* Dropped upstream patches:
  - 17_dont_allow_new_tab_on_desktop.patch
  - 18_fix_crash_in_get_current_uri.patch
  - 19_lazily_initialize_notification_service.patch
  - git_sideplace_sorting.patch
  - git_next_row.patch
  - git_dont_document_browser_option.patch
  - git_browser_compat.patch
  - git_bookmarks_reordering.patch
  - git_listview_context_menus.patch
  - git_use_gtk_grid.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
        g_object_unref (*action_group); /* owned by ui manager */
61
61
}
62
62
 
63
 
 
64
 
char *
65
 
nautilus_get_ui_directory (void)
66
 
{
67
 
        return g_strdup (DATADIR "/nautilus/ui");
68
 
}
69
 
 
70
 
char *
71
 
nautilus_ui_file (const char *partial_path)
72
 
{
73
 
        char *path;
74
 
 
75
 
        path = g_build_filename (DATADIR "/nautilus/ui", partial_path, NULL);
76
 
        if (g_file_test (path, G_FILE_TEST_EXISTS)) {
77
 
                return path;
78
 
        }
79
 
        g_free (path);
80
 
        return NULL;
81
 
}
82
 
 
83
 
const char *
84
 
nautilus_ui_string_get (const char *filename)
85
 
{
86
 
        static GHashTable *ui_cache = NULL;
87
 
        char *ui;
88
 
        char *path;
89
 
 
90
 
        if (ui_cache == NULL) {
91
 
                ui_cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
92
 
                eel_debug_call_at_shutdown_with_data ((GFreeFunc)g_hash_table_destroy, ui_cache);
93
 
        }
94
 
 
95
 
        ui = g_hash_table_lookup (ui_cache, filename);
96
 
        if (ui == NULL) {
97
 
                path = nautilus_ui_file (filename);
98
 
                if (path == NULL || !g_file_get_contents (path, &ui, NULL, NULL)) {
99
 
                        g_warning ("Unable to load ui file %s\n", filename); 
100
 
                        ui = NULL;
101
 
                } 
102
 
                g_free (path);
103
 
 
104
 
                if (ui != NULL)
105
 
                g_hash_table_insert (ui_cache,
106
 
                                     g_strdup (filename),
107
 
                                     ui);
108
 
        }
109
 
        
110
 
        return ui;
111
 
}
112
 
 
113
63
static void
114
64
extension_action_callback (GtkAction *action,
115
65
                           gpointer callback_data)
123
73
        char *name, *label, *tip, *icon_name;
124
74
        gboolean sensitive, priority;
125
75
        GtkAction *action;
126
 
        GIcon *icon;
 
76
        GdkPixbuf *pixbuf;
127
77
 
128
78
        g_object_get (G_OBJECT (item),
129
79
                      "name", &name, "label", &label,
135
85
        action = gtk_action_new (name,
136
86
                                 label,
137
87
                                 tip,
138
 
                                 icon_name);
 
88
                                 NULL);
139
89
 
140
90
        if (icon_name != NULL) {
141
 
                icon = g_themed_icon_new_with_default_fallbacks (icon_name);
142
 
                g_object_set_data_full (G_OBJECT (action), "menu-icon",
143
 
                                        icon,
144
 
                                        g_object_unref);
 
91
                pixbuf = nautilus_ui_get_menu_icon (icon_name);
 
92
                if (pixbuf != NULL) {
 
93
                        gtk_action_set_gicon (action, G_ICON (pixbuf));
 
94
                        g_object_unref (pixbuf);
 
95
                }
145
96
        }
146
97
 
147
98
        gtk_action_set_sensitive (action, sensitive);
179
130
 
180
131
        return FALSE;
181
132
}
 
133
 
 
134
GdkPixbuf *
 
135
nautilus_ui_get_menu_icon (const char *icon_name)
 
136
{
 
137
        NautilusIconInfo *info;
 
138
        GdkPixbuf *pixbuf;
 
139
        int size;
 
140
 
 
141
        size = nautilus_get_icon_size_for_stock_size (GTK_ICON_SIZE_MENU);
 
142
 
 
143
        if (g_path_is_absolute (icon_name)) {
 
144
                info = nautilus_icon_info_lookup_from_path (icon_name, size);
 
145
        } else {
 
146
                info = nautilus_icon_info_lookup_from_name (icon_name, size);
 
147
        }
 
148
        pixbuf = nautilus_icon_info_get_pixbuf_nodefault_at_size (info, size);
 
149
        g_object_unref (info);
 
150
 
 
151
        return pixbuf;
 
152
}