mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-25 02:36:07 +00:00
Use pango ellipsisation instead of truncating the strings. Bug #410113.
2007-07-24 Christian Persch <chpe@gnome.org> * libnautilus-private/nautilus-bookmark.c: (nautilus_bookmark_menu_item_new): * libnautilus-private/nautilus-customization-data.c: (nautilus_customization_data_new), (nautilus_customization_data_get_next_element_for_display): * libnautilus-private/nautilus-customization-data.h: * src/nautilus-application.c: * src/nautilus-bookmark-list.c: (new_bookmark_from_uri): * src/nautilus-navigation-window-menus.c: (connect_proxy_cb), (refresh_go_menu): * src/nautilus-places-sidebar.c: (bookmarks_drop_uris), (drag_data_received_callback): * src/nautilus-property-browser.c: (make_properties_from_directories): * src/nautilus-window-bookmarks.c: (connect_proxy_cb), (update_bookmarks): * src/nautilus-window-menus.c: (nautilus_menus_append_bookmark_to_menu): * test/test-nautilus-wrap-table.c: (main): Use pango ellipsisation instead of truncating the strings. Bug #410113. svn path=/trunk/; revision=13025
This commit is contained in:
parent
32ec3056f6
commit
ee2c880e61
23
ChangeLog
23
ChangeLog
|
@ -1,3 +1,26 @@
|
||||||
|
2007-07-24 Christian Persch <chpe@gnome.org>
|
||||||
|
|
||||||
|
* libnautilus-private/nautilus-bookmark.c:
|
||||||
|
(nautilus_bookmark_menu_item_new):
|
||||||
|
* libnautilus-private/nautilus-customization-data.c:
|
||||||
|
(nautilus_customization_data_new),
|
||||||
|
(nautilus_customization_data_get_next_element_for_display):
|
||||||
|
* libnautilus-private/nautilus-customization-data.h:
|
||||||
|
* src/nautilus-application.c:
|
||||||
|
* src/nautilus-bookmark-list.c: (new_bookmark_from_uri):
|
||||||
|
* src/nautilus-navigation-window-menus.c: (connect_proxy_cb),
|
||||||
|
(refresh_go_menu):
|
||||||
|
* src/nautilus-places-sidebar.c: (bookmarks_drop_uris),
|
||||||
|
(drag_data_received_callback):
|
||||||
|
* src/nautilus-property-browser.c:
|
||||||
|
(make_properties_from_directories):
|
||||||
|
* src/nautilus-window-bookmarks.c: (connect_proxy_cb),
|
||||||
|
(update_bookmarks):
|
||||||
|
* src/nautilus-window-menus.c:
|
||||||
|
(nautilus_menus_append_bookmark_to_menu):
|
||||||
|
* test/test-nautilus-wrap-table.c: (main): Use pango ellipsisation
|
||||||
|
instead of truncating the strings. Bug #410113.
|
||||||
|
|
||||||
2007-07-24 Christian Persch <chpe@gnome.org>
|
2007-07-24 Christian Persch <chpe@gnome.org>
|
||||||
|
|
||||||
* src/nautilus-navigation-window.c: (location_button_create),
|
* src/nautilus-navigation-window.c: (location_button_create),
|
||||||
|
|
|
@ -50,6 +50,8 @@ enum {
|
||||||
#define GENERIC_BOOKMARK_ICON_NAME "gnome-fs-bookmark"
|
#define GENERIC_BOOKMARK_ICON_NAME "gnome-fs-bookmark"
|
||||||
#define MISSING_BOOKMARK_ICON_NAME "gnome-fs-bookmark-missing"
|
#define MISSING_BOOKMARK_ICON_NAME "gnome-fs-bookmark-missing"
|
||||||
|
|
||||||
|
#define ELLIPSISED_MENU_ITEM_MIN_CHARS 32
|
||||||
|
|
||||||
static guint signals[LAST_SIGNAL];
|
static guint signals[LAST_SIGNAL];
|
||||||
|
|
||||||
struct NautilusBookmarkDetails
|
struct NautilusBookmarkDetails
|
||||||
|
@ -525,10 +527,13 @@ nautilus_bookmark_menu_item_new (NautilusBookmark *bookmark)
|
||||||
{
|
{
|
||||||
GtkWidget *menu_item;
|
GtkWidget *menu_item;
|
||||||
GtkWidget *image_widget;
|
GtkWidget *image_widget;
|
||||||
GtkWidget *label;
|
GtkLabel *label;
|
||||||
char *display_name;
|
|
||||||
|
|
||||||
menu_item = gtk_image_menu_item_new ();
|
menu_item = gtk_image_menu_item_new_with_label (bookmark->details->name);
|
||||||
|
label = GTK_LABEL (GTK_BIN (menu_item)->child);
|
||||||
|
gtk_label_set_use_underline (label, FALSE);
|
||||||
|
gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END);
|
||||||
|
gtk_label_set_max_width_chars (label, ELLIPSISED_MENU_ITEM_MIN_CHARS);
|
||||||
|
|
||||||
image_widget = create_image_widget_for_bookmark (bookmark);
|
image_widget = create_image_widget_for_bookmark (bookmark);
|
||||||
if (image_widget != NULL) {
|
if (image_widget != NULL) {
|
||||||
|
@ -536,13 +541,6 @@ nautilus_bookmark_menu_item_new (NautilusBookmark *bookmark)
|
||||||
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item),
|
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_item),
|
||||||
image_widget);
|
image_widget);
|
||||||
}
|
}
|
||||||
display_name = eel_truncate_text_for_menu_item (bookmark->details->name);
|
|
||||||
label = gtk_label_new (display_name);
|
|
||||||
g_free (display_name);
|
|
||||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (menu_item), label);
|
|
||||||
gtk_widget_show (label);
|
|
||||||
|
|
||||||
return menu_item;
|
return menu_item;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,6 @@ typedef enum {
|
||||||
|
|
||||||
struct NautilusCustomizationData {
|
struct NautilusCustomizationData {
|
||||||
char *customization_name;
|
char *customization_name;
|
||||||
CustomizationReadingMode reading_mode;
|
|
||||||
|
|
||||||
GList *public_file_list;
|
GList *public_file_list;
|
||||||
GList *private_file_list;
|
GList *private_file_list;
|
||||||
|
@ -66,10 +65,11 @@ struct NautilusCustomizationData {
|
||||||
|
|
||||||
GdkPixbuf *pattern_frame;
|
GdkPixbuf *pattern_frame;
|
||||||
|
|
||||||
gboolean private_data_was_displayed;
|
|
||||||
gboolean data_is_for_a_menu;
|
|
||||||
int maximum_icon_height;
|
int maximum_icon_height;
|
||||||
int maximum_icon_width;
|
int maximum_icon_width;
|
||||||
|
|
||||||
|
guint private_data_was_displayed : 1;
|
||||||
|
guint reading_mode : 2; /* enough bits for CustomizationReadingMode */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -85,7 +85,6 @@ static void load_name_map_hash_table (NautilusCustomizationData *data);
|
||||||
NautilusCustomizationData*
|
NautilusCustomizationData*
|
||||||
nautilus_customization_data_new (const char *customization_name,
|
nautilus_customization_data_new (const char *customization_name,
|
||||||
gboolean show_public_customizations,
|
gboolean show_public_customizations,
|
||||||
gboolean data_is_for_a_menu,
|
|
||||||
int maximum_icon_height,
|
int maximum_icon_height,
|
||||||
int maximum_icon_width)
|
int maximum_icon_width)
|
||||||
{
|
{
|
||||||
|
@ -142,7 +141,6 @@ nautilus_customization_data_new (const char *customization_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
data->private_data_was_displayed = FALSE;
|
data->private_data_was_displayed = FALSE;
|
||||||
data->data_is_for_a_menu = data_is_for_a_menu;
|
|
||||||
data->customization_name = g_strdup (customization_name);
|
data->customization_name = g_strdup (customization_name);
|
||||||
|
|
||||||
data->maximum_icon_height = maximum_icon_height;
|
data->maximum_icon_height = maximum_icon_height;
|
||||||
|
@ -160,8 +158,7 @@ nautilus_customization_data_get_next_element_for_display (NautilusCustomizationD
|
||||||
char **label_out)
|
char **label_out)
|
||||||
{
|
{
|
||||||
GnomeVFSFileInfo *current_file_info;
|
GnomeVFSFileInfo *current_file_info;
|
||||||
|
char *image_file_name;
|
||||||
char *image_file_name, *filtered_name;
|
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GdkPixbuf *orig_pixbuf;
|
GdkPixbuf *orig_pixbuf;
|
||||||
gboolean is_reset_image;
|
gboolean is_reset_image;
|
||||||
|
@ -238,19 +235,7 @@ nautilus_customization_data_get_next_element_for_display (NautilusCustomizationD
|
||||||
|
|
||||||
*pixbuf_out = pixbuf;
|
*pixbuf_out = pixbuf;
|
||||||
|
|
||||||
filtered_name = format_name_for_display (data, current_file_info->name);
|
*label_out = format_name_for_display (data, current_file_info->name);
|
||||||
/* If the data is for a menu,
|
|
||||||
we want to truncate it and not use the nautilus
|
|
||||||
label because anti-aliased text doesn't look right
|
|
||||||
in menus */
|
|
||||||
if (data->data_is_for_a_menu) {
|
|
||||||
*label_out = eel_truncate_text_for_menu_item (filtered_name);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
*label_out = g_strdup (filtered_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (filtered_name);
|
|
||||||
|
|
||||||
if (data->reading_mode == READ_PRIVATE_CUSTOMIZATIONS) {
|
if (data->reading_mode == READ_PRIVATE_CUSTOMIZATIONS) {
|
||||||
data->private_data_was_displayed = TRUE;
|
data->private_data_was_displayed = TRUE;
|
||||||
|
|
|
@ -42,7 +42,6 @@ typedef struct NautilusCustomizationData NautilusCustomizationData;
|
||||||
|
|
||||||
NautilusCustomizationData* nautilus_customization_data_new (const char *customization_name,
|
NautilusCustomizationData* nautilus_customization_data_new (const char *customization_name,
|
||||||
gboolean show_public_customizations,
|
gboolean show_public_customizations,
|
||||||
gboolean data_is_for_a_menu,
|
|
||||||
int maximum_icon_height,
|
int maximum_icon_height,
|
||||||
int maximum_icon_width);
|
int maximum_icon_width);
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
#include "nautilus-window-manage-views.h"
|
#include "nautilus-window-manage-views.h"
|
||||||
#include <libxml/xmlsave.h>
|
#include <libxml/xmlsave.h>
|
||||||
#include <glib/gstdio.h>
|
#include <glib/gstdio.h>
|
||||||
|
#include <glib/gi18n.h>
|
||||||
#include <bonobo/bonobo-main.h>
|
#include <bonobo/bonobo-main.h>
|
||||||
#include <bonobo/bonobo-object.h>
|
#include <bonobo/bonobo-object.h>
|
||||||
#include <eel/eel-gtk-extensions.h>
|
#include <eel/eel-gtk-extensions.h>
|
||||||
|
@ -70,7 +71,6 @@
|
||||||
#include <gtk/gtksignal.h>
|
#include <gtk/gtksignal.h>
|
||||||
#include <gtk/gtkwindow.h>
|
#include <gtk/gtkwindow.h>
|
||||||
#include <libgnome/gnome-config.h>
|
#include <libgnome/gnome-config.h>
|
||||||
#include <glib/gi18n.h>
|
|
||||||
#include <libgnome/gnome-util.h>
|
#include <libgnome/gnome-util.h>
|
||||||
#include <libgnomeui/gnome-authentication-manager.h>
|
#include <libgnomeui/gnome-authentication-manager.h>
|
||||||
#include <libgnomeui/gnome-client.h>
|
#include <libgnomeui/gnome-client.h>
|
||||||
|
|
|
@ -72,20 +72,6 @@ static void bookmark_monitor_notify_cb (GnomeVFSMonitorHandle *handle,
|
||||||
GnomeVFSMonitorEventType event_type,
|
GnomeVFSMonitorEventType event_type,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
|
|
||||||
static char *
|
|
||||||
get_default_bookmark_name (const char *text_uri)
|
|
||||||
{
|
|
||||||
char *title, *title_truncated;
|
|
||||||
|
|
||||||
title = nautilus_compute_title_for_uri (text_uri);
|
|
||||||
title_truncated = eel_str_middle_truncate (title, MAX_BOOKMARK_LENGTH);
|
|
||||||
g_free (title);
|
|
||||||
|
|
||||||
return title_truncated;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
static NautilusBookmark *
|
static NautilusBookmark *
|
||||||
new_bookmark_from_uri (const char *uri, const char *label)
|
new_bookmark_from_uri (const char *uri, const char *label)
|
||||||
{
|
{
|
||||||
|
@ -96,7 +82,7 @@ new_bookmark_from_uri (const char *uri, const char *label)
|
||||||
|
|
||||||
has_label = FALSE;
|
has_label = FALSE;
|
||||||
if (!label) {
|
if (!label) {
|
||||||
name = get_default_bookmark_name (uri);
|
name = nautilus_compute_title_for_uri (uri);
|
||||||
} else {
|
} else {
|
||||||
name = g_strdup (label);
|
name = g_strdup (label);
|
||||||
has_label = TRUE;
|
has_label = TRUE;
|
||||||
|
|
|
@ -65,6 +65,7 @@
|
||||||
#define MENU_PATH_HISTORY_PLACEHOLDER "/MenuBar/Other Menus/Go/History Placeholder"
|
#define MENU_PATH_HISTORY_PLACEHOLDER "/MenuBar/Other Menus/Go/History Placeholder"
|
||||||
|
|
||||||
#define RESPONSE_FORGET 1000
|
#define RESPONSE_FORGET 1000
|
||||||
|
#define MENU_ITEM_MAX_WIDTH_CHARS 32
|
||||||
|
|
||||||
static void schedule_refresh_go_menu (NautilusNavigationWindow *window);
|
static void schedule_refresh_go_menu (NautilusNavigationWindow *window);
|
||||||
|
|
||||||
|
@ -296,6 +297,23 @@ show_bogus_history_window (NautilusWindow *window,
|
||||||
g_free (detail);
|
g_free (detail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
connect_proxy_cb (GtkActionGroup *action_group,
|
||||||
|
GtkAction *action,
|
||||||
|
GtkWidget *proxy,
|
||||||
|
gpointer dummy)
|
||||||
|
{
|
||||||
|
GtkLabel *label;
|
||||||
|
|
||||||
|
if (!GTK_IS_MENU_ITEM (proxy))
|
||||||
|
return;
|
||||||
|
|
||||||
|
label = GTK_LABEL (GTK_BIN (proxy)->child);
|
||||||
|
|
||||||
|
gtk_label_set_use_underline (label, FALSE);
|
||||||
|
gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END);
|
||||||
|
gtk_label_set_max_width_chars (label, MENU_ITEM_MAX_WIDTH_CHARS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* refresh_go_menu:
|
* refresh_go_menu:
|
||||||
|
@ -322,6 +340,8 @@ refresh_go_menu (NautilusNavigationWindow *window)
|
||||||
|
|
||||||
window->details->go_menu_merge_id = gtk_ui_manager_new_merge_id (ui_manager);
|
window->details->go_menu_merge_id = gtk_ui_manager_new_merge_id (ui_manager);
|
||||||
window->details->go_menu_action_group = gtk_action_group_new ("GoMenuGroup");
|
window->details->go_menu_action_group = gtk_action_group_new ("GoMenuGroup");
|
||||||
|
g_signal_connect (window->details->go_menu_action_group, "connect-proxy",
|
||||||
|
G_CALLBACK (connect_proxy_cb), NULL);
|
||||||
|
|
||||||
gtk_ui_manager_insert_action_group (ui_manager,
|
gtk_ui_manager_insert_action_group (ui_manager,
|
||||||
window->details->go_menu_action_group,
|
window->details->go_menu_action_group,
|
||||||
|
|
|
@ -766,16 +766,18 @@ drag_leave_callback (GtkTreeView *tree_view,
|
||||||
/* Parses a "text/uri-list" string and inserts its URIs as bookmarks */
|
/* Parses a "text/uri-list" string and inserts its URIs as bookmarks */
|
||||||
static void
|
static void
|
||||||
bookmarks_drop_uris (NautilusPlacesSidebar *sidebar,
|
bookmarks_drop_uris (NautilusPlacesSidebar *sidebar,
|
||||||
const char *data,
|
GtkSelectionData *selection_data,
|
||||||
int position)
|
int position)
|
||||||
{
|
{
|
||||||
NautilusBookmark *bookmark;
|
NautilusBookmark *bookmark;
|
||||||
NautilusFile *file;
|
NautilusFile *file;
|
||||||
char *uri, *name, *name_truncated;
|
char *uri, *name;
|
||||||
char **uris;
|
char **uris;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
uris = g_uri_list_extract_uris (data);
|
uris = gtk_selection_data_get_uris (selection_data);
|
||||||
|
if (!uris)
|
||||||
|
return;
|
||||||
|
|
||||||
for (i = 0; uris[i]; i++) {
|
for (i = 0; uris[i]; i++) {
|
||||||
uri = uris[i];
|
uri = uris[i];
|
||||||
|
@ -790,9 +792,8 @@ bookmarks_drop_uris (NautilusPlacesSidebar *sidebar,
|
||||||
nautilus_file_unref (file);
|
nautilus_file_unref (file);
|
||||||
|
|
||||||
name = nautilus_compute_title_for_uri (uri);
|
name = nautilus_compute_title_for_uri (uri);
|
||||||
name_truncated = eel_truncate_text_for_menu_item (name);
|
|
||||||
|
|
||||||
bookmark = nautilus_bookmark_new_with_icon (uri, name_truncated,
|
bookmark = nautilus_bookmark_new_with_icon (uri, name,
|
||||||
FALSE, "gnome-fs-directory");
|
FALSE, "gnome-fs-directory");
|
||||||
|
|
||||||
if (!nautilus_bookmark_list_contains (sidebar->bookmarks, bookmark)) {
|
if (!nautilus_bookmark_list_contains (sidebar->bookmarks, bookmark)) {
|
||||||
|
@ -800,7 +801,6 @@ bookmarks_drop_uris (NautilusPlacesSidebar *sidebar,
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref (bookmark);
|
g_object_unref (bookmark);
|
||||||
g_free (name_truncated);
|
|
||||||
g_free (name);
|
g_free (name);
|
||||||
g_free (uri);
|
g_free (uri);
|
||||||
}
|
}
|
||||||
|
@ -964,7 +964,7 @@ drag_data_received_callback (GtkWidget *widget,
|
||||||
|
|
||||||
switch (info) {
|
switch (info) {
|
||||||
case TEXT_URI_LIST:
|
case TEXT_URI_LIST:
|
||||||
bookmarks_drop_uris (sidebar, selection_data->data, position);
|
bookmarks_drop_uris (sidebar, selection_data, position);
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
break;
|
break;
|
||||||
case GTK_TREE_MODEL_ROW:
|
case GTK_TREE_MODEL_ROW:
|
||||||
|
|
|
@ -1760,7 +1760,6 @@ make_properties_from_directories (NautilusPropertyBrowser *property_browser)
|
||||||
} else {
|
} else {
|
||||||
customization_data = nautilus_customization_data_new (property_browser->details->category,
|
customization_data = nautilus_customization_data_new (property_browser->details->category,
|
||||||
!property_browser->details->remove_mode,
|
!property_browser->details->remove_mode,
|
||||||
FALSE,
|
|
||||||
MAX_ICON_WIDTH,
|
MAX_ICON_WIDTH,
|
||||||
MAX_ICON_HEIGHT);
|
MAX_ICON_HEIGHT);
|
||||||
if (customization_data == NULL) {
|
if (customization_data == NULL) {
|
||||||
|
|
|
@ -39,6 +39,8 @@
|
||||||
#include <eel/eel-vfs-extensions.h>
|
#include <eel/eel-vfs-extensions.h>
|
||||||
#include <eel/eel-gtk-extensions.h>
|
#include <eel/eel-gtk-extensions.h>
|
||||||
|
|
||||||
|
#define MENU_ITEM_MAX_WIDTH_CHARS 32
|
||||||
|
|
||||||
static GtkWindow *bookmarks_window = NULL;
|
static GtkWindow *bookmarks_window = NULL;
|
||||||
static NautilusBookmarkList *bookmarks = NULL;
|
static NautilusBookmarkList *bookmarks = NULL;
|
||||||
|
|
||||||
|
@ -200,6 +202,24 @@ remove_bookmarks_menu_items (NautilusWindow *window)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
connect_proxy_cb (GtkActionGroup *action_group,
|
||||||
|
GtkAction *action,
|
||||||
|
GtkWidget *proxy,
|
||||||
|
gpointer dummy)
|
||||||
|
{
|
||||||
|
GtkLabel *label;
|
||||||
|
|
||||||
|
if (!GTK_IS_MENU_ITEM (proxy))
|
||||||
|
return;
|
||||||
|
|
||||||
|
label = GTK_LABEL (GTK_BIN (proxy)->child);
|
||||||
|
|
||||||
|
gtk_label_set_use_underline (label, FALSE);
|
||||||
|
gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END);
|
||||||
|
gtk_label_set_max_width_chars (label, MENU_ITEM_MAX_WIDTH_CHARS);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_bookmarks (NautilusWindow *window)
|
update_bookmarks (NautilusWindow *window)
|
||||||
{
|
{
|
||||||
|
@ -219,6 +239,8 @@ update_bookmarks (NautilusWindow *window)
|
||||||
|
|
||||||
window->details->bookmarks_merge_id = gtk_ui_manager_new_merge_id (ui_manager);
|
window->details->bookmarks_merge_id = gtk_ui_manager_new_merge_id (ui_manager);
|
||||||
window->details->bookmarks_action_group = gtk_action_group_new ("BookmarksGroup");
|
window->details->bookmarks_action_group = gtk_action_group_new ("BookmarksGroup");
|
||||||
|
g_signal_connect (window->details->bookmarks_action_group, "connect-proxy",
|
||||||
|
G_CALLBACK (connect_proxy_cb), NULL);
|
||||||
|
|
||||||
gtk_ui_manager_insert_action_group (ui_manager,
|
gtk_ui_manager_insert_action_group (ui_manager,
|
||||||
window->details->bookmarks_action_group,
|
window->details->bookmarks_action_group,
|
||||||
|
|
|
@ -152,8 +152,9 @@ nautilus_menus_append_bookmark_to_menu (NautilusWindow *window,
|
||||||
GCallback refresh_callback,
|
GCallback refresh_callback,
|
||||||
NautilusBookmarkFailedCallback failed_callback)
|
NautilusBookmarkFailedCallback failed_callback)
|
||||||
{
|
{
|
||||||
BookmarkHolder *bookmark_holder;
|
BookmarkHolder *bookmark_holder;
|
||||||
char *raw_name, *display_name, *truncated_name, *action_name;
|
char action_name[128];
|
||||||
|
char *name;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GtkAction *action;
|
GtkAction *action;
|
||||||
|
|
||||||
|
@ -161,25 +162,15 @@ nautilus_menus_append_bookmark_to_menu (NautilusWindow *window,
|
||||||
g_assert (NAUTILUS_IS_BOOKMARK (bookmark));
|
g_assert (NAUTILUS_IS_BOOKMARK (bookmark));
|
||||||
|
|
||||||
bookmark_holder = bookmark_holder_new (bookmark, window, refresh_callback, failed_callback);
|
bookmark_holder = bookmark_holder_new (bookmark, window, refresh_callback, failed_callback);
|
||||||
|
name = nautilus_bookmark_get_name (bookmark);
|
||||||
/* We double the underscores here to escape them so gtk+ will know they are
|
|
||||||
* not keyboard accelerator character prefixes. If we ever find we need to
|
|
||||||
* escape more than just the underscores, we'll add a menu helper function
|
|
||||||
* instead of a string utility. (Like maybe escaping control characters.)
|
|
||||||
*/
|
|
||||||
raw_name = nautilus_bookmark_get_name (bookmark);
|
|
||||||
truncated_name = eel_truncate_text_for_menu_item (raw_name);
|
|
||||||
display_name = eel_str_double_underscores (truncated_name);
|
|
||||||
g_free (raw_name);
|
|
||||||
g_free (truncated_name);
|
|
||||||
|
|
||||||
/* Create menu item with pixbuf */
|
/* Create menu item with pixbuf */
|
||||||
pixbuf = nautilus_bookmark_get_pixbuf (bookmark, GTK_ICON_SIZE_MENU);
|
pixbuf = nautilus_bookmark_get_pixbuf (bookmark, GTK_ICON_SIZE_MENU);
|
||||||
|
|
||||||
action_name = g_strdup_printf ("bookmark_%s_%d", parent_id, index_in_parent);
|
g_snprintf (action_name, sizeof (action_name), "%s%d", parent_id, index_in_parent);
|
||||||
|
|
||||||
action = gtk_action_new (action_name,
|
action = gtk_action_new (action_name,
|
||||||
display_name,
|
name,
|
||||||
_("Go to the location specified by this bookmark"),
|
_("Go to the location specified by this bookmark"),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
@ -206,8 +197,7 @@ nautilus_menus_append_bookmark_to_menu (NautilusWindow *window,
|
||||||
FALSE);
|
FALSE);
|
||||||
|
|
||||||
g_object_unref (pixbuf);
|
g_object_unref (pixbuf);
|
||||||
g_free (action_name);
|
g_free (name);
|
||||||
g_free (display_name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -53,7 +53,7 @@ main (int argc, char* argv[])
|
||||||
|
|
||||||
|
|
||||||
/* Use nautilus_customization to make the emblem widgets */
|
/* Use nautilus_customization to make the emblem widgets */
|
||||||
customization_data = nautilus_customization_data_new ("emblems", TRUE, TRUE,
|
customization_data = nautilus_customization_data_new ("emblems", TRUE,
|
||||||
NAUTILUS_ICON_SIZE_SMALL,
|
NAUTILUS_ICON_SIZE_SMALL,
|
||||||
NAUTILUS_ICON_SIZE_SMALL);
|
NAUTILUS_ICON_SIZE_SMALL);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue