Commit efcade0a authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

added file-menu.[ch] and file-dialog-menu.[ch]

2004-05-13  Michael Natterer  <mitch@gimp.org>

	* app/menus/Makefile.am: added file-menu.[ch] and
	file-dialog-menu.[ch]

	* app/menus/menus.[ch]: removed menus_open_recent_add()...

	* app/menus/file-menu.[ch]: ...and added it here as file_menu_setup().

	* app/menus/image-menu.c
	* app/menus/toolbox-menu.c: changed accordingly.

	* app/menus/file-dialog-menu.[ch]: added factored out code from the
	file-open and file-save menus as file_dialog_menu_setup().

	* app/menus/file-open-menu.c
	* app/menus/file-save-menu.c: call file_dialog_menu_setup().
parent c6f4bc76
2004-05-13 Michael Natterer <mitch@gimp.org>
* app/menus/Makefile.am: added file-menu.[ch] and
file-dialog-menu.[ch]
* app/menus/menus.[ch]: removed menus_open_recent_add()...
* app/menus/file-menu.[ch]: ...and added it here as file_menu_setup().
* app/menus/image-menu.c
* app/menus/toolbox-menu.c: changed accordingly.
* app/menus/file-dialog-menu.[ch]: added factored out code from the
file-open and file-save menus as file_dialog_menu_setup().
* app/menus/file-open-menu.c
* app/menus/file-save-menu.c: call file_dialog_menu_setup().
2004-05-12 Michael Natterer <mitch@gimp.org>
* app/actions/documents-actions.c
......
......@@ -7,6 +7,10 @@ libappmenus_a_SOURCES = \
menus.c \
menus.h \
\
file-dialog-menu.c \
file-dialog-menu.h \
file-menu.c \
file-menu.h \
file-open-menu.c \
file-open-menu.h \
file-save-menu.c \
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "menus-types.h"
#include "plug-in/plug-in-proc.h"
#include "widgets/gimpuimanager.h"
#include "file-dialog-menu.h"
void
file_dialog_menu_setup (GimpUIManager *manager,
const gchar *ui_path,
GSList *file_procs,
const gchar *xcf_proc_name)
{
GSList *list;
guint merge_id;
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
for (list = file_procs; list; list = g_slist_next (list))
{
PlugInProcDef *file_proc = list->data;
gchar *path;
if (! strcmp (file_proc->db_info.name, xcf_proc_name))
path = g_strdup_printf ("%s/%s", ui_path, "Internal");
else
path = g_strdup (ui_path);
gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
path,
file_proc->db_info.name,
file_proc->db_info.name,
GTK_UI_MANAGER_MENUITEM,
FALSE);
g_free (path);
}
}
/* The GIMP -- an open manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __FILE_DIALOG_MENU_H__
#define __FILE_DIALOG_MENU_H__
void file_dialog_menu_setup (GimpUIManager *manager,
const gchar *ui_path,
GSList *file_procs,
const gchar *xcf_proc_name);
#endif /* __FILE_DIALOG_MENU_H__ */
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "menus-types.h"
#include "config/gimpguiconfig.h"
#include "core/gimp.h"
#include "widgets/gimpuimanager.h"
#include "file-menu.h"
void
file_menu_setup (GimpUIManager *manager,
const gchar *ui_path)
{
gint n_entries;
guint merge_id;
gint i;
g_return_if_fail (GIMP_IS_UI_MANAGER (manager));
g_return_if_fail (ui_path != NULL);
n_entries = GIMP_GUI_CONFIG (manager->gimp->config)->last_opened_size;
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
for (i = 0; i < n_entries; i++)
{
gchar *action_name;
gchar *action_path;
action_name = g_strdup_printf ("file-open-recent-%02d", i + 1);
action_path = g_strdup_printf ("%s/File/Open Recent/Files", ui_path);
gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
action_path, action_name, action_name,
GTK_UI_MANAGER_MENUITEM,
FALSE);
g_free (action_name);
g_free (action_path);
}
}
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __FILE_MENU_H__
#define __FILE_MENU_H__
void file_menu_setup (GimpUIManager *manager,
const gchar *ui_path);
#endif /* __FILE_MENU_H__ */
......@@ -18,18 +18,15 @@
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "menus-types.h"
#include "core/gimp.h"
#include "plug-in/plug-in-proc.h"
#include "widgets/gimpuimanager.h"
#include "file-dialog-menu.h"
#include "file-open-menu.h"
......@@ -37,28 +34,7 @@ void
file_open_menu_setup (GimpUIManager *manager,
const gchar *ui_path)
{
GSList *list;
guint merge_id;
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
for (list = manager->gimp->load_procs; list; list = g_slist_next (list))
{
PlugInProcDef *file_proc = list->data;
gchar *path;
if (! strcmp (file_proc->db_info.name, "gimp_xcf_load"))
path = g_strdup_printf ("%s/%s", ui_path, "Internal");
else
path = g_strdup (ui_path);
gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
path,
file_proc->db_info.name,
file_proc->db_info.name,
GTK_UI_MANAGER_MENUITEM,
FALSE);
g_free (path);
}
file_dialog_menu_setup (manager, ui_path,
manager->gimp->load_procs,
"gimp_xcf_load");
}
......@@ -18,18 +18,15 @@
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "menus-types.h"
#include "core/gimp.h"
#include "plug-in/plug-in-proc.h"
#include "widgets/gimpuimanager.h"
#include "file-dialog-menu.h"
#include "file-save-menu.h"
......@@ -37,28 +34,7 @@ void
file_save_menu_setup (GimpUIManager *manager,
const gchar *ui_path)
{
GSList *list;
guint merge_id;
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
for (list = manager->gimp->save_procs; list; list = g_slist_next (list))
{
PlugInProcDef *file_proc = list->data;
gchar *path;
if (! strcmp (file_proc->db_info.name, "gimp_xcf_save"))
path = g_strdup_printf ("%s/%s", ui_path, "Internal");
else
path = g_strdup (ui_path);
gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
path,
file_proc->db_info.name,
file_proc->db_info.name,
GTK_UI_MANAGER_MENUITEM,
FALSE);
g_free (path);
}
file_dialog_menu_setup (manager, ui_path,
manager->gimp->save_procs,
"gimp_xcf_save");
}
......@@ -22,8 +22,8 @@
#include "menus-types.h"
#include "file-menu.h"
#include "image-menu.h"
#include "menus.h"
#include "plug-in-menus.h"
......@@ -31,6 +31,6 @@ void
image_menu_setup (GimpUIManager *manager,
const gchar *ui_path)
{
menus_open_recent_add (manager, ui_path);
file_menu_setup (manager, ui_path);
plug_in_menus_setup (manager, ui_path);
}
......@@ -21,21 +21,14 @@
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "menus-types.h"
#include "config/gimpguiconfig.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "file/file-utils.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpmenufactory.h"
#include "widgets/gimpuimanager.h"
#include "actions/actions.h"
......@@ -334,39 +327,6 @@ menus_clear (Gimp *gimp)
g_print ("TODO: implement menus_clear()\n");
}
void
menus_open_recent_add (GimpUIManager *manager,
const gchar *ui_path)
{
gint n_entries;
guint merge_id;
gint i;
g_return_if_fail (GIMP_IS_UI_MANAGER (manager));
g_return_if_fail (ui_path != NULL);
n_entries = GIMP_GUI_CONFIG (manager->gimp->config)->last_opened_size;
merge_id = gtk_ui_manager_new_merge_id (GTK_UI_MANAGER (manager));
for (i = 0; i < n_entries; i++)
{
gchar *action_name;
gchar *action_path;
action_name = g_strdup_printf ("file-open-recent-%02d", i + 1);
action_path = g_strdup_printf ("%s/File/Open Recent/Files", ui_path);
gtk_ui_manager_add_ui (GTK_UI_MANAGER (manager), merge_id,
action_path, action_name, action_name,
GTK_UI_MANAGER_MENUITEM,
FALSE);
g_free (action_name);
g_free (action_path);
}
}
/* private functions */
......
......@@ -23,14 +23,11 @@
extern GimpMenuFactory *global_menu_factory;
void menus_init (Gimp *gimp);
void menus_exit (Gimp *gimp);
void menus_restore (Gimp *gimp);
void menus_save (Gimp *gimp);
void menus_clear (Gimp *gimp);
void menus_open_recent_add (GimpUIManager *manager,
const gchar *ui_path);
void menus_init (Gimp *gimp);
void menus_exit (Gimp *gimp);
void menus_restore (Gimp *gimp);
void menus_save (Gimp *gimp);
void menus_clear (Gimp *gimp);
#endif /* __MENUS_H__ */
......@@ -22,7 +22,7 @@
#include "menus-types.h"
#include "menus.h"
#include "file-menu.h"
#include "plug-in-menus.h"
#include "toolbox-menu.h"
......@@ -31,6 +31,6 @@ void
toolbox_menu_setup (GimpUIManager *manager,
const gchar *ui_path)
{
menus_open_recent_add (manager, ui_path);
file_menu_setup (manager, ui_path);
plug_in_menus_setup (manager, ui_path);
}
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