Commit 63ca433d authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

added "gchar *name_changed_signal" to GimpViewableClass which defaults to

2002-04-29  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpviewable.[ch]: added "gchar *name_changed_signal"
	to GimpViewableClass which defaults to "name_changed".

	* app/widgets/gimplistitem.c
	* app/widgets/gimpmenuitem.c: connect to
	viewable_class->name_changed_signal instead of just
	"name_changed". Fixed possible UI inconsistency where the previous
	viewable's tooltip would have been displayed.

	* app/core/gimpimagefile.[ch]: set name_changed_signal to
	"info_changed" so views can update their tooltips correctly.
	Merged the separate image_state and thumb_state states into one
	state variable and extended the state enum. Added description
	strings for all states. Show the file size for all files, not only
	for those with a thumbnail. Enabled display of outdated
	thumbnails.

	* app/gui/file-open-dialog.c: some changes because
	gimp_imagefile_get_description() returns 3 instead of 2 lines of
	text now.

	* app/widgets/gimpcontainerview-utils.c: show the imagefile's
	description in the tooltip.

	* app/gui/menus.c
	* app/gui/documents-commands.[ch]
	* app/widgets/gimpdocumentview.c: added functions to remove
	"dangling" document history entries. Updated the context menu so
	all functions can be accessed through it.
parent 05581ddf
2002-04-29 Michael Natterer <mitch@gimp.org>
* app/core/gimpviewable.[ch]: added "gchar *name_changed_signal"
to GimpViewableClass which defaults to "name_changed".
* app/widgets/gimplistitem.c
* app/widgets/gimpmenuitem.c: connect to
viewable_class->name_changed_signal instead of just
"name_changed". Fixed possible UI inconsistency where the previous
viewable's tooltip would have been displayed.
* app/core/gimpimagefile.[ch]: set name_changed_signal to
"info_changed" so views can update their tooltips correctly.
Merged the separate image_state and thumb_state states into one
state variable and extended the state enum. Added description
strings for all states. Show the file size for all files, not only
for those with a thumbnail. Enabled display of outdated
thumbnails.
* app/gui/file-open-dialog.c: some changes because
gimp_imagefile_get_description() returns 3 instead of 2 lines of
text now.
* app/widgets/gimpcontainerview-utils.c: show the imagefile's
description in the tooltip.
* app/gui/menus.c
* app/gui/documents-commands.[ch]
* app/widgets/gimpdocumentview.c: added functions to remove
"dangling" document history entries. Updated the context menu so
all functions can be accessed through it.
2002-04-28 Sven Neumann <sven@gimp.org>
* app/tools/gimpairbrushtool.c
......
......@@ -100,8 +100,8 @@ documents_delete_document_cmd_callback (GtkWidget *widget,
void
documents_refresh_documents_cmd_callback (GtkWidget *widget,
gpointer data)
documents_recreate_preview_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDocumentView *view;
......@@ -113,6 +113,36 @@ documents_refresh_documents_cmd_callback (GtkWidget *widget,
gtk_button_clicked (GTK_BUTTON (view->refresh_button));
}
void
documents_reload_previews_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDocumentView *view;
view = (GimpDocumentView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
gimp_button_extended_clicked (GIMP_BUTTON (view->refresh_button),
GDK_SHIFT_MASK);
}
void
documents_delete_dangling_documents_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDocumentView *view;
view = (GimpDocumentView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
gimp_button_extended_clicked (GIMP_BUTTON (view->refresh_button),
GDK_CONTROL_MASK);
}
void
documents_menu_update (GtkItemFactory *factory,
gpointer data)
......@@ -127,11 +157,13 @@ documents_menu_update (GtkItemFactory *factory,
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Open Image", imagefile);
SET_SENSITIVE ("/Raise or Open Image", imagefile);
SET_SENSITIVE ("/File Open Dialog...", TRUE);
SET_SENSITIVE ("/Remove Entry", imagefile);
SET_SENSITIVE ("/Refresh History", TRUE);
SET_SENSITIVE ("/Open Image", imagefile);
SET_SENSITIVE ("/Raise or Open Image", imagefile);
SET_SENSITIVE ("/File Open Dialog...", TRUE);
SET_SENSITIVE ("/Remove Entry", imagefile);
SET_SENSITIVE ("/Recreate Preview", imagefile);
SET_SENSITIVE ("/Reload all Previews", imagefile);
SET_SENSITIVE ("/Remove Dangling Entries", imagefile);
#undef SET_SENSITIVE
}
......@@ -20,19 +20,23 @@
#define __DOCUMENTS_COMMANDS_H__
void documents_open_document_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_raise_or_open_document_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_file_open_dialog_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_delete_document_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_refresh_documents_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_open_document_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_raise_or_open_document_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_file_open_dialog_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_delete_document_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_recreate_preview_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_reload_previews_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_delete_dangling_documents_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_menu_update (GtkItemFactory *factory,
gpointer data);
void documents_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __DOCUMENTS_COMMANDS_H__ */
This diff is collapsed.
......@@ -36,7 +36,11 @@ typedef enum
GIMP_IMAGEFILE_STATE_UNKNOWN,
GIMP_IMAGEFILE_STATE_REMOTE,
GIMP_IMAGEFILE_STATE_NOT_FOUND,
GIMP_IMAGEFILE_STATE_EXISTS
GIMP_IMAGEFILE_STATE_EXISTS,
GIMP_IMAGEFILE_STATE_THUMBNAIL_NOT_FOUND,
GIMP_IMAGEFILE_STATE_THUMBNAIL_OLD,
GIMP_IMAGEFILE_STATE_THUMBNAIL_FAILED,
GIMP_IMAGEFILE_STATE_THUMBNAIL_OK
} GimpImagefileState;
......@@ -54,18 +58,17 @@ struct _GimpImagefile
{
GimpViewable parent_instance;
GimpImagefileState state;
time_t image_mtime;
gssize image_size;
time_t thumb_mtime;
gint width;
gint height;
gssize size;
GimpImageType type;
gint n_layers;
GimpImagefileState image_state;
time_t image_mtime;
GimpImagefileState thumb_state;
time_t thumb_mtime;
gchar *description;
gboolean static_desc;
};
......
......@@ -109,6 +109,8 @@ gimp_viewable_class_init (GimpViewableClass *klass)
gimp_object_class->get_memsize = gimp_viewable_get_memsize;
klass->name_changed_signal = "name_changed";
klass->invalidate_preview = gimp_viewable_real_invalidate_preview;
klass->size_changed = NULL;
......
......@@ -47,6 +47,8 @@ struct _GimpViewableClass
{
GimpObjectClass parent_class;
const gchar *name_changed_signal;
/* signals */
void (* invalidate_preview) (GimpViewable *viewable);
void (* size_changed) (GimpViewable *viewable);
......
......@@ -296,11 +296,20 @@ file_open_dialog_create (Gimp *gimp)
gtk_box_pack_start (GTK_BOX (vbox2), open_options_title, FALSE, FALSE, 0);
gtk_widget_show (open_options_title);
label = gtk_label_new (" \n ");
label = gtk_label_new (" \n \n ");
gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.0);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
gtk_widget_show (label);
/* eek */
{
GtkRequisition requisition;
gtk_widget_size_request (label, &requisition);
gtk_widget_set_size_request (label, -1, requisition.height);
}
g_signal_connect (G_OBJECT (open_options_imagefile), "info_changed",
G_CALLBACK (file_open_imagefile_info_changed),
label);
......
......@@ -100,8 +100,8 @@ documents_delete_document_cmd_callback (GtkWidget *widget,
void
documents_refresh_documents_cmd_callback (GtkWidget *widget,
gpointer data)
documents_recreate_preview_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDocumentView *view;
......@@ -113,6 +113,36 @@ documents_refresh_documents_cmd_callback (GtkWidget *widget,
gtk_button_clicked (GTK_BUTTON (view->refresh_button));
}
void
documents_reload_previews_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDocumentView *view;
view = (GimpDocumentView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
gimp_button_extended_clicked (GIMP_BUTTON (view->refresh_button),
GDK_SHIFT_MASK);
}
void
documents_delete_dangling_documents_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDocumentView *view;
view = (GimpDocumentView *) gimp_widget_get_callback_context (widget);
if (! view)
return;
gimp_button_extended_clicked (GIMP_BUTTON (view->refresh_button),
GDK_CONTROL_MASK);
}
void
documents_menu_update (GtkItemFactory *factory,
gpointer data)
......@@ -127,11 +157,13 @@ documents_menu_update (GtkItemFactory *factory,
#define SET_SENSITIVE(menu,condition) \
gimp_item_factory_set_sensitive (factory, menu, (condition) != 0)
SET_SENSITIVE ("/Open Image", imagefile);
SET_SENSITIVE ("/Raise or Open Image", imagefile);
SET_SENSITIVE ("/File Open Dialog...", TRUE);
SET_SENSITIVE ("/Remove Entry", imagefile);
SET_SENSITIVE ("/Refresh History", TRUE);
SET_SENSITIVE ("/Open Image", imagefile);
SET_SENSITIVE ("/Raise or Open Image", imagefile);
SET_SENSITIVE ("/File Open Dialog...", TRUE);
SET_SENSITIVE ("/Remove Entry", imagefile);
SET_SENSITIVE ("/Recreate Preview", imagefile);
SET_SENSITIVE ("/Reload all Previews", imagefile);
SET_SENSITIVE ("/Remove Dangling Entries", imagefile);
#undef SET_SENSITIVE
}
......@@ -20,19 +20,23 @@
#define __DOCUMENTS_COMMANDS_H__
void documents_open_document_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_raise_or_open_document_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_file_open_dialog_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_delete_document_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_refresh_documents_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_open_document_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_raise_or_open_document_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_file_open_dialog_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_delete_document_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_recreate_preview_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_reload_previews_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_delete_dangling_documents_cmd_callback (GtkWidget *widget,
gpointer data);
void documents_menu_update (GtkItemFactory *factory,
gpointer data);
void documents_menu_update (GtkItemFactory *factory,
gpointer data);
#endif /* __DOCUMENTS_COMMANDS_H__ */
......@@ -296,11 +296,20 @@ file_open_dialog_create (Gimp *gimp)
gtk_box_pack_start (GTK_BOX (vbox2), open_options_title, FALSE, FALSE, 0);
gtk_widget_show (open_options_title);
label = gtk_label_new (" \n ");
label = gtk_label_new (" \n \n ");
gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.0);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
gtk_widget_show (label);
/* eek */
{
GtkRequisition requisition;
gtk_widget_size_request (label, &requisition);
gtk_widget_set_size_request (label, -1, requisition.height);
}
g_signal_connect (G_OBJECT (open_options_imagefile), "info_changed",
G_CALLBACK (file_open_imagefile_info_changed),
label);
......
......@@ -1866,31 +1866,34 @@ static GimpItemFactoryEntry documents_entries[] =
{ { N_("/Open Image"), NULL,
documents_open_document_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
NULL,
NULL, NULL },
NULL, NULL, NULL },
{ { N_("/Raise or Open Image"), NULL,
documents_raise_or_open_document_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
NULL,
NULL, NULL },
NULL, NULL, NULL },
{ { N_("/File Open Dialog..."), NULL,
documents_file_open_dialog_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
NULL,
NULL, NULL },
NULL, NULL, NULL },
{ { N_("/Remove Entry"), NULL,
documents_delete_document_cmd_callback, 0,
"<StockItem>", GTK_STOCK_DELETE },
NULL,
NULL, NULL },
NULL, NULL, NULL },
SEPARATOR ("/---"),
{ { N_("/Refresh History"), NULL,
documents_refresh_documents_cmd_callback, 0,
{ { N_("/Recreate Preview"), NULL,
documents_recreate_preview_cmd_callback, 0,
"<StockItem>", GTK_STOCK_REFRESH },
NULL,
NULL, NULL }
NULL, NULL, NULL },
{ { N_("/Reload all Previews"), NULL,
documents_reload_previews_cmd_callback, 0,
"<StockItem>", GTK_STOCK_REFRESH },
NULL, NULL, NULL },
{ { N_("/Remove Dangling Entries"), NULL,
documents_delete_dangling_documents_cmd_callback, 0,
"<StockItem>", GTK_STOCK_REFRESH },
NULL, NULL, NULL },
};
......
......@@ -1866,31 +1866,34 @@ static GimpItemFactoryEntry documents_entries[] =
{ { N_("/Open Image"), NULL,
documents_open_document_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
NULL,
NULL, NULL },
NULL, NULL, NULL },
{ { N_("/Raise or Open Image"), NULL,
documents_raise_or_open_document_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
NULL,
NULL, NULL },
NULL, NULL, NULL },
{ { N_("/File Open Dialog..."), NULL,
documents_file_open_dialog_cmd_callback, 0,
"<StockItem>", GTK_STOCK_OPEN },
NULL,
NULL, NULL },
NULL, NULL, NULL },
{ { N_("/Remove Entry"), NULL,
documents_delete_document_cmd_callback, 0,
"<StockItem>", GTK_STOCK_DELETE },
NULL,
NULL, NULL },
NULL, NULL, NULL },
SEPARATOR ("/---"),
{ { N_("/Refresh History"), NULL,
documents_refresh_documents_cmd_callback, 0,
{ { N_("/Recreate Preview"), NULL,
documents_recreate_preview_cmd_callback, 0,
"<StockItem>", GTK_STOCK_REFRESH },
NULL,
NULL, NULL }
NULL, NULL, NULL },
{ { N_("/Reload all Previews"), NULL,
documents_reload_previews_cmd_callback, 0,
"<StockItem>", GTK_STOCK_REFRESH },
NULL, NULL, NULL },
{ { N_("/Remove Dangling Entries"), NULL,
documents_delete_dangling_documents_cmd_callback, 0,
"<StockItem>", GTK_STOCK_REFRESH },
NULL, NULL, NULL },
};
......
......@@ -382,11 +382,21 @@ gimp_container_view_imagefile_name_func (GtkWidget *widget,
if (tooltip)
{
gchar *filename;
gchar *filename;
const gchar *desc;
filename = file_utils_uri_to_utf8_filename (uri);
*tooltip = filename;
desc = gimp_imagefile_get_description (imagefile);
if (desc)
{
*tooltip = g_strdup_printf ("%s\n%s", filename, desc);
g_free (filename);
}
else
{
*tooltip = filename;
}
}
if (imagefile->width > 0 && imagefile->height > 0)
......
......@@ -176,7 +176,8 @@ gimp_document_view_new (GimpViewType view_type,
gimp_editor_add_button (GIMP_EDITOR (editor->view),
GTK_STOCK_REFRESH,
_("Recreate preview\n"
"<Shift> Reload all previews"),
"<Shift> Reload all previews\n"
"<Ctrl> Remove Dangling Entries"),
NULL,
G_CALLBACK (gimp_document_view_refresh_clicked),
G_CALLBACK (gimp_document_view_refresh_extended_clicked),
......@@ -333,6 +334,18 @@ gimp_document_view_refresh_clicked (GtkWidget *widget,
}
}
static void
gimp_document_view_delete_dangling_foreach (GimpImagefile *imagefile,
GimpContainer *container)
{
gimp_imagefile_update (imagefile);
if (imagefile->state == GIMP_IMAGEFILE_STATE_NOT_FOUND)
{
gimp_container_remove (container, GIMP_OBJECT (imagefile));
}
}
static void
gimp_document_view_refresh_extended_clicked (GtkWidget *widget,
guint state,
......@@ -342,7 +355,13 @@ gimp_document_view_refresh_extended_clicked (GtkWidget *widget,
editor = GIMP_CONTAINER_EDITOR (view);
if (state & GDK_SHIFT_MASK)
if (state & GDK_CONTROL_MASK)
{
gimp_container_foreach (editor->view->container,
(GFunc) gimp_document_view_delete_dangling_foreach,
editor->view->container);
}
else if (state & GDK_SHIFT_MASK)
{
gimp_container_foreach (editor->view->container,
(GFunc) gimp_imagefile_update,
......
......@@ -324,7 +324,8 @@ gimp_list_item_real_set_viewable (GimpListItem *list_item,
gimp_list_item_name_changed (viewable, list_item);
g_signal_connect_object (G_OBJECT (viewable), "name_changed",
g_signal_connect_object (G_OBJECT (viewable),
GIMP_VIEWABLE_GET_CLASS (viewable)->name_changed_signal,
G_CALLBACK (gimp_list_item_name_changed),
list_item, 0);
......@@ -592,21 +593,16 @@ gimp_list_item_name_changed (GimpViewable *viewable,
{
if (list_item->get_name_func)
{
gchar *name;
gchar *tooltip;
gchar *name = NULL;
gchar *tooltip = NULL;
name = list_item->get_name_func (GTK_WIDGET (list_item), &tooltip);
gtk_label_set_text (GTK_LABEL (list_item->name_label), name);
gimp_help_set_help_data (GTK_WIDGET (list_item), tooltip, NULL);
g_free (name);
if (tooltip)
{
gimp_help_set_help_data (GTK_WIDGET (list_item), tooltip, NULL);
g_free (tooltip);
}
g_free (tooltip);
}
else
{
......
......@@ -146,7 +146,8 @@ gimp_menu_item_real_set_viewable (GimpMenuItem *menu_item,
gimp_menu_item_name_changed (viewable, menu_item);
g_signal_connect_object (G_OBJECT (viewable), "name_changed",
g_signal_connect_object (G_OBJECT (viewable),
GIMP_VIEWABLE_GET_CLASS (viewable)->name_changed_signal,
G_CALLBACK (gimp_menu_item_name_changed),
menu_item, 0);
......@@ -185,21 +186,16 @@ gimp_menu_item_name_changed (GimpViewable *viewable,
{
if (menu_item->get_name_func)
{
gchar *name;
gchar *tooltip;
gchar *name = NULL;
gchar *tooltip = NULL;
name = menu_item->get_name_func (GTK_WIDGET (menu_item), &tooltip);
gtk_label_set_text (GTK_LABEL (menu_item->name_label), name);
gimp_help_set_help_data (GTK_WIDGET (menu_item), tooltip, NULL);
g_free (name);
if (tooltip)
{
gimp_help_set_help_data (GTK_WIDGET (menu_item), tooltip, NULL);
g_free (tooltip);
}
g_free (tooltip);
}
else
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment