Commit 5f57c07f authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

removed.

2003-01-31  Michael Natterer  <mitch@gimp.org>

	* app/gui/file-dialog-utils.[ch] (file_dialog_update_menus): removed.

	* app/gui/file-save-menu.[ch] (file_save_menu_update): added here.

	* app/gui/menus.c: register it as non-automatic update_func.

	* app/gui/file-save-dialog.c: changed accordingly.
parent 27698a2b
2003-01-31 Michael Natterer <mitch@gimp.org>
* app/gui/file-dialog-utils.[ch] (file_dialog_update_menus): removed.
* app/gui/file-save-menu.[ch] (file_save_menu_update): added here.
* app/gui/menus.c: register it as non-automatic update_func.
* app/gui/file-save-dialog.c: changed accordingly.
2003-01-31 Sven Neumann <sven@gimp.org>
 
* app/config/gimpconfig-params.h
......
......@@ -100,6 +100,9 @@ file_dialog_new (Gimp *gimp,
GTK_TYPE_MENU,
gimp,
FALSE);
g_object_set_data (G_OBJECT (filesel), "gimp-item-factory", item_factory);
option_menu = gtk_option_menu_new ();
gtk_box_pack_end (GTK_BOX (hbox), option_menu, FALSE, FALSE, 0);
gtk_widget_show (option_menu);
......@@ -178,53 +181,3 @@ file_dialog_update_name (PlugInProcDef *proc,
g_string_free (s, TRUE);
}
}
void
file_dialog_update_menus (GSList *procs,
GimpImageType image_type)
{
PlugInProcDef *file_proc;
PlugInImageType plug_in_image_type = 0;
switch (image_type)
{
case GIMP_RGB_IMAGE:
plug_in_image_type = PLUG_IN_RGB_IMAGE;
break;
case GIMP_RGBA_IMAGE:
plug_in_image_type = PLUG_IN_RGBA_IMAGE;
break;
case GIMP_GRAY_IMAGE:
plug_in_image_type = PLUG_IN_GRAY_IMAGE;
break;
case GIMP_GRAYA_IMAGE:
plug_in_image_type = PLUG_IN_GRAYA_IMAGE;
break;
case GIMP_INDEXED_IMAGE:
plug_in_image_type = PLUG_IN_INDEXED_IMAGE;
break;
case GIMP_INDEXEDA_IMAGE:
plug_in_image_type = PLUG_IN_INDEXEDA_IMAGE;
break;
default:
g_assert_not_reached ();
break;
}
for (; procs; procs = g_slist_next (procs))
{
file_proc = (PlugInProcDef *) procs->data;
if (file_proc->db_info.proc_type != GIMP_EXTENSION)
{
GtkItemFactory *item_factory;
item_factory =
GTK_ITEM_FACTORY (gimp_item_factory_from_path (file_proc->menu_path));
gimp_item_factory_set_sensitive (item_factory,
file_proc->menu_path,
(file_proc->image_types_val & plug_in_image_type));
}
}
}
......@@ -20,21 +20,19 @@
#define __FILE_DIALOG_UTILS_H__
GtkWidget * file_dialog_new (Gimp *gimp,
GimpMenuFactory *menu_factory,
const gchar *menu_identifier,
const gchar *title,
const gchar *wmclass_name,
const gchar *help_data,
GCallback ok_callback);
GtkWidget * file_dialog_new (Gimp *gimp,
GimpMenuFactory *menu_factory,
const gchar *menu_identifier,
const gchar *title,
const gchar *wmclass_name,
const gchar *help_data,
GCallback ok_callback);
void file_dialog_show (GtkWidget *filesel);
gboolean file_dialog_hide (GtkWidget *filesel);
void file_dialog_show (GtkWidget *filesel);
gboolean file_dialog_hide (GtkWidget *filesel);
void file_dialog_update_name (PlugInProcDef *proc,
GtkFileSelection *filesel);
void file_dialog_update_menus (GSList *procs,
GimpImageType image_type);
void file_dialog_update_name (PlugInProcDef *proc,
GtkFileSelection *filesel);
#endif /* __FILE_DIALOG_UTILS_H__ */
......@@ -44,6 +44,7 @@
#include "file/file-save.h"
#include "file/file-utils.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpmenufactory.h"
#include "file-dialog-utils.h"
......@@ -94,7 +95,8 @@ void
file_save_dialog_show (GimpImage *gimage,
GimpMenuFactory *menu_factory)
{
gchar *filename;
GimpItemFactory *item_factory;
gchar *filename;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (GIMP_IS_MENU_FACTORY (menu_factory));
......@@ -127,8 +129,10 @@ file_save_dialog_show (GimpImage *gimage,
g_free (filename);
file_dialog_update_menus (gimage->gimp->save_procs,
gimp_drawable_type (gimp_image_active_drawable (gimage)));
item_factory = g_object_get_data (G_OBJECT (filesave), "gimp-item-factory");
gimp_item_factory_update (item_factory,
gimp_image_active_drawable (gimage));
file_dialog_show (filesave);
}
......@@ -137,8 +141,9 @@ void
file_save_a_copy_dialog_show (GimpImage *gimage,
GimpMenuFactory *menu_factory)
{
const gchar *uri;
gchar *filename = NULL;
GimpItemFactory *item_factory;
const gchar *uri;
gchar *filename = NULL;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (GIMP_IS_MENU_FACTORY (menu_factory));
......@@ -172,8 +177,12 @@ file_save_a_copy_dialog_show (GimpImage *gimage,
filename :
"." G_DIR_SEPARATOR_S);
file_dialog_update_menus (gimage->gimp->save_procs,
gimp_drawable_type (gimp_image_active_drawable (gimage)));
g_free (filename);
item_factory = g_object_get_data (G_OBJECT (filesave), "gimp-item-factory");
gimp_item_factory_update (item_factory,
gimp_image_active_drawable (gimage));
file_dialog_show (filesave);
}
......
......@@ -100,6 +100,9 @@ file_dialog_new (Gimp *gimp,
GTK_TYPE_MENU,
gimp,
FALSE);
g_object_set_data (G_OBJECT (filesel), "gimp-item-factory", item_factory);
option_menu = gtk_option_menu_new ();
gtk_box_pack_end (GTK_BOX (hbox), option_menu, FALSE, FALSE, 0);
gtk_widget_show (option_menu);
......@@ -178,53 +181,3 @@ file_dialog_update_name (PlugInProcDef *proc,
g_string_free (s, TRUE);
}
}
void
file_dialog_update_menus (GSList *procs,
GimpImageType image_type)
{
PlugInProcDef *file_proc;
PlugInImageType plug_in_image_type = 0;
switch (image_type)
{
case GIMP_RGB_IMAGE:
plug_in_image_type = PLUG_IN_RGB_IMAGE;
break;
case GIMP_RGBA_IMAGE:
plug_in_image_type = PLUG_IN_RGBA_IMAGE;
break;
case GIMP_GRAY_IMAGE:
plug_in_image_type = PLUG_IN_GRAY_IMAGE;
break;
case GIMP_GRAYA_IMAGE:
plug_in_image_type = PLUG_IN_GRAYA_IMAGE;
break;
case GIMP_INDEXED_IMAGE:
plug_in_image_type = PLUG_IN_INDEXED_IMAGE;
break;
case GIMP_INDEXEDA_IMAGE:
plug_in_image_type = PLUG_IN_INDEXEDA_IMAGE;
break;
default:
g_assert_not_reached ();
break;
}
for (; procs; procs = g_slist_next (procs))
{
file_proc = (PlugInProcDef *) procs->data;
if (file_proc->db_info.proc_type != GIMP_EXTENSION)
{
GtkItemFactory *item_factory;
item_factory =
GTK_ITEM_FACTORY (gimp_item_factory_from_path (file_proc->menu_path));
gimp_item_factory_set_sensitive (item_factory,
file_proc->menu_path,
(file_proc->image_types_val & plug_in_image_type));
}
}
}
......@@ -20,21 +20,19 @@
#define __FILE_DIALOG_UTILS_H__
GtkWidget * file_dialog_new (Gimp *gimp,
GimpMenuFactory *menu_factory,
const gchar *menu_identifier,
const gchar *title,
const gchar *wmclass_name,
const gchar *help_data,
GCallback ok_callback);
GtkWidget * file_dialog_new (Gimp *gimp,
GimpMenuFactory *menu_factory,
const gchar *menu_identifier,
const gchar *title,
const gchar *wmclass_name,
const gchar *help_data,
GCallback ok_callback);
void file_dialog_show (GtkWidget *filesel);
gboolean file_dialog_hide (GtkWidget *filesel);
void file_dialog_show (GtkWidget *filesel);
gboolean file_dialog_hide (GtkWidget *filesel);
void file_dialog_update_name (PlugInProcDef *proc,
GtkFileSelection *filesel);
void file_dialog_update_menus (GSList *procs,
GimpImageType image_type);
void file_dialog_update_name (PlugInProcDef *proc,
GtkFileSelection *filesel);
#endif /* __FILE_DIALOG_UTILS_H__ */
......@@ -44,6 +44,7 @@
#include "file/file-save.h"
#include "file/file-utils.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpmenufactory.h"
#include "file-dialog-utils.h"
......@@ -94,7 +95,8 @@ void
file_save_dialog_show (GimpImage *gimage,
GimpMenuFactory *menu_factory)
{
gchar *filename;
GimpItemFactory *item_factory;
gchar *filename;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (GIMP_IS_MENU_FACTORY (menu_factory));
......@@ -127,8 +129,10 @@ file_save_dialog_show (GimpImage *gimage,
g_free (filename);
file_dialog_update_menus (gimage->gimp->save_procs,
gimp_drawable_type (gimp_image_active_drawable (gimage)));
item_factory = g_object_get_data (G_OBJECT (filesave), "gimp-item-factory");
gimp_item_factory_update (item_factory,
gimp_image_active_drawable (gimage));
file_dialog_show (filesave);
}
......@@ -137,8 +141,9 @@ void
file_save_a_copy_dialog_show (GimpImage *gimage,
GimpMenuFactory *menu_factory)
{
const gchar *uri;
gchar *filename = NULL;
GimpItemFactory *item_factory;
const gchar *uri;
gchar *filename = NULL;
g_return_if_fail (GIMP_IS_IMAGE (gimage));
g_return_if_fail (GIMP_IS_MENU_FACTORY (menu_factory));
......@@ -172,8 +177,12 @@ file_save_a_copy_dialog_show (GimpImage *gimage,
filename :
"." G_DIR_SEPARATOR_S);
file_dialog_update_menus (gimage->gimp->save_procs,
gimp_drawable_type (gimp_image_active_drawable (gimage)));
g_free (filename);
item_factory = g_object_get_data (G_OBJECT (filesave), "gimp-item-factory");
gimp_item_factory_update (item_factory,
gimp_image_active_drawable (gimage));
file_dialog_show (filesave);
}
......
......@@ -27,6 +27,7 @@
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpdrawable.h"
#include "plug-in/plug-in-proc.h"
......@@ -99,3 +100,56 @@ file_save_menu_setup (GimpItemFactory *factory)
g_free (help_page);
}
}
void
file_save_menu_update (GtkItemFactory *item_factory,
gpointer data)
{
GimpDrawable *drawable;
PlugInImageType plug_in_image_type = 0;
GSList *procs;
drawable = GIMP_DRAWABLE (data);
switch (gimp_drawable_type (drawable))
{
case GIMP_RGB_IMAGE:
plug_in_image_type = PLUG_IN_RGB_IMAGE;
break;
case GIMP_RGBA_IMAGE:
plug_in_image_type = PLUG_IN_RGBA_IMAGE;
break;
case GIMP_GRAY_IMAGE:
plug_in_image_type = PLUG_IN_GRAY_IMAGE;
break;
case GIMP_GRAYA_IMAGE:
plug_in_image_type = PLUG_IN_GRAYA_IMAGE;
break;
case GIMP_INDEXED_IMAGE:
plug_in_image_type = PLUG_IN_INDEXED_IMAGE;
break;
case GIMP_INDEXEDA_IMAGE:
plug_in_image_type = PLUG_IN_INDEXEDA_IMAGE;
break;
default:
g_assert_not_reached ();
break;
}
for (procs = GIMP_ITEM_FACTORY (item_factory)->gimp->save_procs;
procs;
procs = g_slist_next (procs))
{
PlugInProcDef *file_proc;
file_proc = (PlugInProcDef *) procs->data;
if (file_proc->db_info.proc_type != GIMP_EXTENSION)
{
gimp_item_factory_set_sensitive (item_factory,
file_proc->menu_path,
(file_proc->image_types_val &
plug_in_image_type));
}
}
}
......@@ -24,7 +24,9 @@ extern GimpItemFactoryEntry file_save_menu_entries[];
extern gint n_file_save_menu_entries;
void file_save_menu_setup (GimpItemFactory *factory);
void file_save_menu_setup (GimpItemFactory *factory);
void file_save_menu_update (GtkItemFactory *item_factory,
gpointer data);
#endif /* __FILE_SAVE_MENU_H__ */
......@@ -117,7 +117,8 @@ menus_init (Gimp *gimp)
gimp_menu_factory_menu_register (global_menu_factory,
"<Save>", "save",
file_save_menu_setup, NULL, FALSE,
file_save_menu_setup,
file_save_menu_update, FALSE,
n_file_save_menu_entries,
file_save_menu_entries);
......
......@@ -27,6 +27,7 @@
#include "gui-types.h"
#include "core/gimp.h"
#include "core/gimpdrawable.h"
#include "plug-in/plug-in-proc.h"
......@@ -99,3 +100,56 @@ file_save_menu_setup (GimpItemFactory *factory)
g_free (help_page);
}
}
void
file_save_menu_update (GtkItemFactory *item_factory,
gpointer data)
{
GimpDrawable *drawable;
PlugInImageType plug_in_image_type = 0;
GSList *procs;
drawable = GIMP_DRAWABLE (data);
switch (gimp_drawable_type (drawable))
{
case GIMP_RGB_IMAGE:
plug_in_image_type = PLUG_IN_RGB_IMAGE;
break;
case GIMP_RGBA_IMAGE:
plug_in_image_type = PLUG_IN_RGBA_IMAGE;
break;
case GIMP_GRAY_IMAGE:
plug_in_image_type = PLUG_IN_GRAY_IMAGE;
break;
case GIMP_GRAYA_IMAGE:
plug_in_image_type = PLUG_IN_GRAYA_IMAGE;
break;
case GIMP_INDEXED_IMAGE:
plug_in_image_type = PLUG_IN_INDEXED_IMAGE;
break;
case GIMP_INDEXEDA_IMAGE:
plug_in_image_type = PLUG_IN_INDEXEDA_IMAGE;
break;
default:
g_assert_not_reached ();
break;
}
for (procs = GIMP_ITEM_FACTORY (item_factory)->gimp->save_procs;
procs;
procs = g_slist_next (procs))
{
PlugInProcDef *file_proc;
file_proc = (PlugInProcDef *) procs->data;
if (file_proc->db_info.proc_type != GIMP_EXTENSION)
{
gimp_item_factory_set_sensitive (item_factory,
file_proc->menu_path,
(file_proc->image_types_val &
plug_in_image_type));
}
}
}
......@@ -24,7 +24,9 @@ extern GimpItemFactoryEntry file_save_menu_entries[];
extern gint n_file_save_menu_entries;
void file_save_menu_setup (GimpItemFactory *factory);
void file_save_menu_setup (GimpItemFactory *factory);
void file_save_menu_update (GtkItemFactory *item_factory,
gpointer data);
#endif /* __FILE_SAVE_MENU_H__ */
......@@ -117,7 +117,8 @@ menus_init (Gimp *gimp)
gimp_menu_factory_menu_register (global_menu_factory,
"<Save>", "save",
file_save_menu_setup, NULL, FALSE,
file_save_menu_setup,
file_save_menu_update, FALSE,
n_file_save_menu_entries,
file_save_menu_entries);
......
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