mirror of
https://gitlab.gnome.org/GNOME/nautilus
synced 2024-08-25 02:36:07 +00:00
Strip extensions using eel_filename_strip_extension(). Fixes #309510.
2008-09-01 Christian Neumair <cneumair@gnome.org> * libnautilus-private/nautilus-customization-data.c (format_name_for_display), (load_name_map_hash_table): * src/file-manager/fm-directory-view.c (add_template_to_templates_menus): * src/nautilus-property-browser.c (nautilus_property_browser_drag_data_get), (make_properties_from_directories): * test/test-nautilus-wrap-table.c (main): Strip extensions using eel_filename_strip_extension(). Fixes #309510. Thanks to Paolo Borelli <pborelli@katamail.com> and Jared Moore <jaredm@gmx.com>. svn path=/trunk/; revision=14555
This commit is contained in:
parent
80946aa5b9
commit
974ad6ae24
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2008-09-01 Christian Neumair <cneumair@gnome.org>
|
||||
|
||||
* libnautilus-private/nautilus-customization-data.c
|
||||
(format_name_for_display), (load_name_map_hash_table):
|
||||
* src/file-manager/fm-directory-view.c
|
||||
(add_template_to_templates_menus):
|
||||
* src/nautilus-property-browser.c
|
||||
(nautilus_property_browser_drag_data_get),
|
||||
(make_properties_from_directories):
|
||||
* test/test-nautilus-wrap-table.c (main):
|
||||
Strip extensions using eel_filename_strip_extension(). Fixes #309510.
|
||||
Thanks to Paolo Borelli <pborelli@katamail.com> and Jared Moore
|
||||
<jaredm@gmx.com>.
|
||||
|
||||
2008-09-01 Christian Neumair <cneumair@gnome.org>
|
||||
|
||||
* configure.in:
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <eel/eel-gdk-pixbuf-extensions.h>
|
||||
#include <eel/eel-glib-extensions.h>
|
||||
#include <eel/eel-gtk-extensions.h>
|
||||
#include <eel/eel-vfs-extensions.h>
|
||||
#include <eel/eel-string.h>
|
||||
#include <eel/eel-xml-extensions.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
@ -77,7 +78,6 @@ static char * get_private_customization_path (const char *custom
|
|||
static char * get_file_path_for_mode (const NautilusCustomizationData *data,
|
||||
const char *file_name);
|
||||
static char* format_name_for_display (NautilusCustomizationData *data, const char *name);
|
||||
static char* strip_extension (const char* string_to_strip);
|
||||
static void load_name_map_hash_table (NautilusCustomizationData *data);
|
||||
|
||||
|
||||
|
@ -412,7 +412,7 @@ format_name_for_display (NautilusCustomizationData *data, const char* name)
|
|||
|
||||
/* map file names to display names using the mappings defined in the hash table */
|
||||
|
||||
formatted_str = strip_extension (name);
|
||||
formatted_str = eel_filename_strip_extension (name);
|
||||
if (data->name_map_hash != NULL) {
|
||||
mapped_name = g_hash_table_lookup (data->name_map_hash, formatted_str);
|
||||
if (mapped_name) {
|
||||
|
@ -467,18 +467,3 @@ load_name_map_hash_table (NautilusCustomizationData *data)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* utility routine to strip the extension from the passed in string */
|
||||
static char*
|
||||
strip_extension (const char* string_to_strip)
|
||||
{
|
||||
char *result_str, *temp_str;
|
||||
if (string_to_strip == NULL)
|
||||
return NULL;
|
||||
|
||||
result_str = g_strdup(string_to_strip);
|
||||
temp_str = strrchr(result_str, '.');
|
||||
if (temp_str)
|
||||
*temp_str = '\0';
|
||||
return result_str;
|
||||
}
|
||||
|
|
|
@ -5251,25 +5251,21 @@ add_template_to_templates_menus (FMDirectoryView *directory_view,
|
|||
const char *menu_path,
|
||||
const char *popup_bg_path)
|
||||
{
|
||||
char *tip, *uri, *name;
|
||||
char *dot, *escaped_label;
|
||||
char *tmp, *tip, *uri, *name;
|
||||
char *escaped_label;
|
||||
GdkPixbuf *pixbuf;
|
||||
char *action_name;
|
||||
CreateTemplateParameters *parameters;
|
||||
GtkUIManager *ui_manager;
|
||||
GtkAction *action;
|
||||
|
||||
tmp = nautilus_file_get_display_name (file);
|
||||
name = eel_filename_strip_extension (tmp);
|
||||
g_free (tmp);
|
||||
|
||||
name = nautilus_file_get_display_name (file);
|
||||
uri = nautilus_file_get_uri (file);
|
||||
tip = g_strdup_printf (_("Create Document from template \"%s\""), name);
|
||||
|
||||
/* Remove extension */
|
||||
dot = strrchr (name, '.');
|
||||
if (dot != NULL) {
|
||||
*dot = 0;
|
||||
}
|
||||
|
||||
action_name = escape_action_name (uri, "template_");
|
||||
escaped_label = eel_str_double_underscores (name);
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include <eel/eel-labeled-image.h>
|
||||
#include <eel/eel-stock-dialogs.h>
|
||||
#include <eel/eel-string.h>
|
||||
#include <eel/eel-vfs-extensions.h>
|
||||
#include <eel/eel-xml-extensions.h>
|
||||
#include <librsvg/rsvg.h>
|
||||
#include <libxml/parser.h>
|
||||
|
@ -165,7 +166,6 @@ static void emblems_changed_callback (GObject
|
|||
NautilusPropertyBrowser *property_browser);
|
||||
|
||||
/* misc utilities */
|
||||
static char * strip_extension (const char *string_to_strip);
|
||||
static void element_clicked_callback (GtkWidget *image_table,
|
||||
GtkWidget *child,
|
||||
const EelImageTableEvent *event,
|
||||
|
@ -605,7 +605,7 @@ nautilus_property_browser_drag_data_get (GtkWidget *widget,
|
|||
is_reset = FALSE;
|
||||
if (strcmp (property_browser->details->drag_type,
|
||||
"property/keyword") == 0) {
|
||||
char* keyword_str = strip_extension(property_browser->details->dragged_file);
|
||||
char *keyword_str = eel_filename_strip_extension(property_browser->details->dragged_file);
|
||||
gtk_selection_data_set(selection_data, selection_data->target, 8, keyword_str, strlen(keyword_str));
|
||||
g_free(keyword_str);
|
||||
return;
|
||||
|
@ -1609,22 +1609,6 @@ element_clicked_callback (GtkWidget *image_table,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* utility routine to strip the extension from the passed in string */
|
||||
static char*
|
||||
strip_extension (const char* string_to_strip)
|
||||
{
|
||||
char *result_str, *temp_str;
|
||||
if (string_to_strip == NULL)
|
||||
return NULL;
|
||||
|
||||
result_str = g_strdup(string_to_strip);
|
||||
temp_str = strrchr(result_str, '.');
|
||||
if (temp_str)
|
||||
*temp_str = '\0';
|
||||
return result_str;
|
||||
}
|
||||
|
||||
static void
|
||||
labeled_image_configure (EelLabeledImage *labeled_image)
|
||||
{
|
||||
|
@ -1667,7 +1651,6 @@ make_properties_from_directories (NautilusPropertyBrowser *property_browser)
|
|||
GList *icons, *l;
|
||||
char *icon_name;
|
||||
char *keyword;
|
||||
char *extension;
|
||||
GtkWidget *property_image;
|
||||
GtkWidget *blank;
|
||||
guint num_images;
|
||||
|
@ -1706,11 +1689,7 @@ make_properties_from_directories (NautilusPropertyBrowser *property_browser)
|
|||
property_image = labeled_image_new (object_label, object_pixbuf, object_name, PANGO_SCALE_LARGE);
|
||||
eel_labeled_image_set_fixed_image_height (EEL_LABELED_IMAGE (property_image), MAX_EMBLEM_HEIGHT);
|
||||
|
||||
keyword = g_strdup (object_name);
|
||||
extension = strchr (keyword, '.');
|
||||
if (extension) {
|
||||
*extension = '\0';
|
||||
}
|
||||
keyword = eel_filename_strip_extension (object_name);
|
||||
property_browser->details->keywords = g_list_prepend (property_browser->details->keywords,
|
||||
keyword);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <eel/eel-wrap-table.h>
|
||||
#include <eel/eel-labeled-image.h>
|
||||
#include <eel/eel-vfs-extensions.h>
|
||||
#include <libnautilus-private/nautilus-customization-data.h>
|
||||
#include <libnautilus-private/nautilus-icon-info.h>
|
||||
|
||||
|
@ -11,7 +12,7 @@ main (int argc, char* argv[])
|
|||
NautilusCustomizationData *customization_data;
|
||||
GtkWidget *window;
|
||||
GtkWidget *emblems_table, *button, *scroller;
|
||||
char *emblem_name, *dot_pos;
|
||||
char *emblem_name, *stripped_name;
|
||||
GdkPixbuf *pixbuf;
|
||||
char *label;
|
||||
|
||||
|
@ -62,16 +63,13 @@ main (int argc, char* argv[])
|
|||
&pixbuf,
|
||||
&label) == GNOME_VFS_OK) {
|
||||
|
||||
/* strip the suffix, if any */
|
||||
dot_pos = strrchr(emblem_name, '.');
|
||||
if (dot_pos) {
|
||||
*dot_pos = '\0';
|
||||
}
|
||||
stripped_name = eel_filename_strip_extension (emblem_name);
|
||||
g_free (emblem_name);
|
||||
|
||||
if (strcmp (emblem_name, "erase") == 0) {
|
||||
if (strcmp (stripped_name, "erase") == 0) {
|
||||
g_object_unref (pixbuf);
|
||||
g_free (label);
|
||||
g_free (emblem_name);
|
||||
g_free (stripped_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -82,7 +80,7 @@ main (int argc, char* argv[])
|
|||
/* Attach parameters and signal handler. */
|
||||
g_object_set_data_full (G_OBJECT (button),
|
||||
"nautilus_property_name",
|
||||
emblem_name,
|
||||
stripped_name,
|
||||
(GDestroyNotify) g_free);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (emblems_table), button);
|
||||
|
|
Loading…
Reference in a new issue