Skip to content

Commit

Permalink
Hide .gqv extension from collection name in collection window title a…
Browse files Browse the repository at this point in the history
…nd recent menu list.
  • Loading branch information
Laurent Monin committed Nov 23, 2008
1 parent 968a923 commit 50306a6
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
15 changes: 14 additions & 1 deletion src/collect.c
Original file line number Diff line number Diff line change
Expand Up @@ -983,11 +983,24 @@ static void collection_window_refresh(CollectWindow *cw)

static void collection_window_update_title(CollectWindow *cw)
{
gboolean free_name = FALSE;
gchar *name;
gchar *buf;

if (!cw) return;

buf = g_strdup_printf(_("%s - Collection - %s"), cw->cd->name, GQ_APPNAME);
if (file_extension_match(cw->cd->name, GQ_COLLECTION_EXT))
{
name = remove_extension_from_path(cw->cd->name);
free_name = TRUE;
}
else
{
name = cw->cd->name;
}

buf = g_strdup_printf(_("%s - Collection - %s"), name, GQ_APPNAME);
if (free_name) g_free(name);
gtk_window_set_title(GTK_WINDOW(cw->window), buf);
g_free(buf);
}
Expand Down
18 changes: 16 additions & 2 deletions src/layout_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1008,8 +1008,22 @@ static void layout_menu_recent_update(LayoutWindow *lw)

while (list)
{
item = menu_item_add_simple(menu, filename_from_path((gchar *)list->data),
G_CALLBACK(layout_menu_recent_cb), lw);
const gchar *filename = filename_from_path((gchar *)list->data);
gchar *name;
gboolean free_name = FALSE;

if (file_extension_match(filename, GQ_COLLECTION_EXT))
{
name = remove_extension_from_path(filename);
free_name = TRUE;
}
else
{
name = (gchar *) filename;
}

item = menu_item_add_simple(menu, name, G_CALLBACK(layout_menu_recent_cb), lw);
if (free_name) g_free(name);
g_object_set_data(G_OBJECT(item), "recent_index", GINT_TO_POINTER(n));
list = list->next;
n++;
Expand Down

0 comments on commit 50306a6

Please sign in to comment.