Commit 77af2d63 authored by Matthias Clasen's avatar Matthias Clasen

Rename GtkMenuMerge to GtkUIManager.

parent 3cb958de
2003-08-26 Matthias Clasen <maclas@gmx.de>
Rename GtkMenuMerge to GtkUIManager.
* gtk/gtkuimanager.[hc]: New files.
* gtk/gtkmenumerge.[hc]: Removed.
* gtk/Makefile.am:
* gtk/gtk.h:
* tests/testmerge.c:
* tests/testactions.c:
* demos/gtk-demo/appwindow.c: Replace all uses of GtkMenuMerge by GtkUIManager.
* demos/gtk-demo/appwindow.c: Make GtkMenuMerge demo less intimidating: add comments to
entries array, remove newlines from ui definition. Don't use the ::add_widget signal.
Mon Aug 25 17:28:04 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_forall): Don't
......
2003-08-26 Matthias Clasen <maclas@gmx.de>
Rename GtkMenuMerge to GtkUIManager.
* gtk/gtkuimanager.[hc]: New files.
* gtk/gtkmenumerge.[hc]: Removed.
* gtk/Makefile.am:
* gtk/gtk.h:
* tests/testmerge.c:
* tests/testactions.c:
* demos/gtk-demo/appwindow.c: Replace all uses of GtkMenuMerge by GtkUIManager.
* demos/gtk-demo/appwindow.c: Make GtkMenuMerge demo less intimidating: add comments to
entries array, remove newlines from ui definition. Don't use the ::add_widget signal.
Mon Aug 25 17:28:04 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_forall): Don't
......
2003-08-26 Matthias Clasen <maclas@gmx.de>
Rename GtkMenuMerge to GtkUIManager.
* gtk/gtkuimanager.[hc]: New files.
* gtk/gtkmenumerge.[hc]: Removed.
* gtk/Makefile.am:
* gtk/gtk.h:
* tests/testmerge.c:
* tests/testactions.c:
* demos/gtk-demo/appwindow.c: Replace all uses of GtkMenuMerge by GtkUIManager.
* demos/gtk-demo/appwindow.c: Make GtkMenuMerge demo less intimidating: add comments to
entries array, remove newlines from ui definition. Don't use the ::add_widget signal.
Mon Aug 25 17:28:04 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_forall): Don't
......
2003-08-26 Matthias Clasen <maclas@gmx.de>
Rename GtkMenuMerge to GtkUIManager.
* gtk/gtkuimanager.[hc]: New files.
* gtk/gtkmenumerge.[hc]: Removed.
* gtk/Makefile.am:
* gtk/gtk.h:
* tests/testmerge.c:
* tests/testactions.c:
* demos/gtk-demo/appwindow.c: Replace all uses of GtkMenuMerge by GtkUIManager.
* demos/gtk-demo/appwindow.c: Make GtkMenuMerge demo less intimidating: add comments to
entries array, remove newlines from ui definition. Don't use the ::add_widget signal.
Mon Aug 25 17:28:04 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_forall): Don't
......
2003-08-26 Matthias Clasen <maclas@gmx.de>
Rename GtkMenuMerge to GtkUIManager.
* gtk/gtkuimanager.[hc]: New files.
* gtk/gtkmenumerge.[hc]: Removed.
* gtk/Makefile.am:
* gtk/gtk.h:
* tests/testmerge.c:
* tests/testactions.c:
* demos/gtk-demo/appwindow.c: Replace all uses of GtkMenuMerge by GtkUIManager.
* demos/gtk-demo/appwindow.c: Make GtkMenuMerge demo less intimidating: add comments to
entries array, remove newlines from ui definition. Don't use the ::add_widget signal.
Mon Aug 25 17:28:04 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtknotebook.c (gtk_notebook_forall): Don't
......
......@@ -33,69 +33,107 @@ activate_action (GtkAction *action)
}
#ifndef N_
#define N_(String) String
#endif
static GtkActionGroupEntry entries[] = {
{ "FileMenu", N_("_File"), NULL, NULL, NULL, NULL, NULL },
{ "PreferencesMenu", N_("_Preferences"), NULL, NULL, NULL, NULL, NULL },
{ "ColorMenu", N_("_Color"), NULL, NULL, NULL, NULL, NULL },
{ "ShapeMenu", N_("_Shape"), NULL, NULL, NULL, NULL, NULL },
{ "HelpMenu", N_("_Help"), NULL, NULL, NULL, NULL, NULL },
{ "New", N_("_New"), GTK_STOCK_NEW, "<control>N", N_("Create a new file"), G_CALLBACK (activate_action), NULL },
{ "Open", N_("_Open"), GTK_STOCK_OPEN, "<control>O", N_("Open a file"), G_CALLBACK (activate_action), NULL },
{ "Save", N_("_Save"), GTK_STOCK_SAVE, "<control>S", N_("Save current file"), G_CALLBACK (activate_action), NULL },
{ "SaveAs", N_("Save _As..."), GTK_STOCK_SAVE, NULL, N_("Save to a file"), G_CALLBACK (activate_action), NULL },
{ "Quit", N_("_Quit"), GTK_STOCK_QUIT, "<control>Q", N_("Quit"), G_CALLBACK (activate_action), NULL },
{ "Red", N_("_Red"), NULL, "<control>R", N_("Blood"), G_CALLBACK (activate_action), NULL, GTK_ACTION_RADIO },
{ "Green", N_("_Green"), NULL, "<control>G", N_("Grass"), G_CALLBACK (activate_action), NULL, GTK_ACTION_RADIO, "Red" },
{ "Blue", N_("_Blue"), NULL, "<control>B", N_("Sky"), G_CALLBACK (activate_action), NULL, GTK_ACTION_RADIO, "Red" },
{ "Square", N_("_Square"), NULL, "<control>S", N_("Square"), G_CALLBACK (activate_action), NULL, GTK_ACTION_RADIO },
{ "Rectangle", N_("_Rectangle"), NULL, "<control>R", N_("Rectangle"), G_CALLBACK (activate_action), NULL, GTK_ACTION_RADIO, "Square" },
{ "Oval", N_("_Oval"), NULL, "<control>O", N_("Egg"), G_CALLBACK (activate_action), NULL, GTK_ACTION_RADIO, "Square" },
{ "About", N_("_About"), NULL, "<control>A", N_("About"), G_CALLBACK (activate_action), NULL },
{ "Logo", NULL, "demo-gtk-logo", NULL, N_("GTK+"), G_CALLBACK (activate_action), NULL },
{ "FileMenu", "_File" }, /* name, label */
{ "PreferencesMenu", "_Preferences" }, /* name, label */
{ "ColorMenu", "_Color" }, /* name, label */
{ "ShapeMenu", "_Shape" }, /* name, label */
{ "HelpMenu", "_Help" }, /* name, label */
{ "New", "_New", /* name, label */
GTK_STOCK_NEW, "<control>N", /* stock_id, accelerator */
"Create a new file", /* tooltip */
G_CALLBACK (activate_action) },
{ "Open", "_Open", /* name, label */
GTK_STOCK_OPEN, "<control>O", /* stock_id, accelerator */
"Open a file", /* tooltip */
G_CALLBACK (activate_action) },
{ "Save", "_Save", /* name, label */
GTK_STOCK_SAVE, "<control>S", /* stock_id, accelerator */
"Save current file", /* tooltip */
G_CALLBACK (activate_action) },
{ "SaveAs", "Save _As...", /* name, label */
GTK_STOCK_SAVE, NULL, /* stock_id, accelerator */
"Save to a file", /* tooltip */
G_CALLBACK (activate_action) },
{ "Quit", "_Quit", /* name, label */
GTK_STOCK_QUIT, "<control>Q", /* stock_id, accelerator */
"Quit", /* tooltip */
G_CALLBACK (activate_action) },
{ "Red", "_Red", /* name, label */
NULL, "<control>R", /* stock_id, accelerator */
"Blood", /* tooltip */
G_CALLBACK (activate_action), NULL,
GTK_ACTION_RADIO }, /* entry type */
{ "Green", "_Green", /* name, label */
NULL, "<control>G", /* stock_id, accelerator */
"Grass", /* tooltip */
G_CALLBACK (activate_action), NULL,
GTK_ACTION_RADIO, "Red" }, /* entry type, radio group */
{ "Blue", "_Blue", /* name, label */
NULL, "<control>B", /* stock_id, accelerator */
"Sky", /* tooltip */
G_CALLBACK (activate_action), NULL,
GTK_ACTION_RADIO, "Red" }, /* entry type, radio group */
{ "Square", "_Square", /* name, label */
NULL, "<control>S", /* stock_id, accelerator */
"Square", /* tooltip */
G_CALLBACK (activate_action), NULL,
GTK_ACTION_RADIO }, /* entry type */
{ "Rectangle", "_Rectangle", /* name, label */
NULL, "<control>R", /* stock_id, accelerator */
"Rectangle", /* tooltip */
G_CALLBACK (activate_action), NULL,
GTK_ACTION_RADIO, "Square" }, /* entry type, radio group */
{ "Oval", "_Oval", /* name, label */
NULL, "<control>O", /* stock_id, accelerator */
"Egg", /* tooltip */
G_CALLBACK (activate_action), NULL,
GTK_ACTION_RADIO, "Square" }, /* entry type, radio group */
{ "About", "_About", /* name, label */
NULL, "<control>A", /* stock_id, accelerator */
"About", /* tooltip */
G_CALLBACK (activate_action) },
{ "Logo", NULL, /* name, label */
"demo-gtk-logo", NULL, /* stock_id, accelerator */
"GTK+", /* tooltip */
G_CALLBACK (activate_action) },
};
static guint n_entries = G_N_ELEMENTS (entries);
static const gchar *ui_info =
"<Root>\n"
" <menu>\n"
" <submenu name='FileMenu'>\n"
" <menuitem name='New'/>\n"
" <menuitem name='Open'/>\n"
" <menuitem name='Save'/>\n"
" <menuitem name='SaveAs'/>\n"
" <separator name='Sep1'/>\n"
" <menuitem name='Quit'/>\n"
" </submenu>\n"
" <submenu name='PreferencesMenu'>\n"
" <submenu name='ColorMenu'>\n"
" <menuitem name='Red'/>\n"
" <menuitem name='Green'/>\n"
" <menuitem name='Blue'/>\n"
" </submenu>\n"
" <submenu name='ShapeMenu'>\n"
" <menuitem name='Square'/>\n"
" <menuitem name='Rectangle'/>\n"
" <menuitem name='Oval'/>\n"
" </submenu>\n"
" </submenu>\n"
" <submenu name='HelpMenu'>\n"
" <menuitem name='About'/>\n"
" </submenu>\n"
" </menu>\n"
" <dockitem>\n"
" <toolitem name='Open'/>\n"
" <toolitem name='Quit'/>\n"
" <separator name='Sep1'/>\n"
" <toolitem name='Logo'/>\n"
" </dockitem>\n"
"</Root>\n";
"<Root>"
" <menu name='MenuBar'>"
" <submenu name='FileMenu'>"
" <menuitem name='New'/>"
" <menuitem name='Open'/>"
" <menuitem name='Save'/>"
" <menuitem name='SaveAs'/>"
" <separator name='Sep1'/>"
" <menuitem name='Quit'/>"
" </submenu>"
" <submenu name='PreferencesMenu'>"
" <submenu name='ColorMenu'>"
" <menuitem name='Red'/>"
" <menuitem name='Green'/>"
" <menuitem name='Blue'/>"
" </submenu>"
" <submenu name='ShapeMenu'>"
" <menuitem name='Square'/>"
" <menuitem name='Rectangle'/>"
" <menuitem name='Oval'/>"
" </submenu>"
" </submenu>"
" <submenu name='HelpMenu'>"
" <menuitem name='About'/>"
" </submenu>"
" </menu>"
" <dockitem name='ToolBar'>"
" <toolitem name='Open'/>"
" <toolitem name='Quit'/>"
" <separator name='Sep1'/>"
" <toolitem name='Logo'/>"
" </dockitem>"
"</Root>";
......@@ -213,33 +251,6 @@ update_resize_grip (GtkWidget *widget,
}
static void
add_widget (GtkMenuMerge *merge,
GtkWidget *widget,
GtkTable *table)
{
if (GTK_IS_MENU_BAR (widget))
{
gtk_table_attach (GTK_TABLE (table),
widget,
/* X direction */ /* Y direction */
0, 1, 0, 1,
GTK_EXPAND | GTK_FILL, 0,
0, 0);
}
else if (GTK_IS_TOOLBAR (widget))
{
gtk_table_attach (GTK_TABLE (table),
widget,
/* X direction */ /* Y direction */
0, 1, 1, 2,
GTK_EXPAND | GTK_FILL, 0,
0, 0);
}
gtk_widget_show (widget);
}
GtkWidget *
do_appwindow (void)
{
......@@ -249,10 +260,11 @@ do_appwindow (void)
GtkWidget *statusbar;
GtkWidget *contents;
GtkWidget *sw;
GtkWidget *bar;
GtkTextBuffer *buffer;
GtkActionGroup *action_group;
GtkAction *action;
GtkMenuMerge *merge;
GtkUIManager *merge;
GError *error = NULL;
register_stock_icons ();
......@@ -278,23 +290,40 @@ do_appwindow (void)
action_group = gtk_action_group_new ("AppWindowActions");
gtk_action_group_add_actions (action_group, entries, n_entries);
action = gtk_action_group_get_action (action_group, "red");
action = gtk_action_group_get_action (action_group, "Red");
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
action = gtk_action_group_get_action (action_group, "square");
action = gtk_action_group_get_action (action_group, "Square");
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
merge = gtk_menu_merge_new ();
gtk_menu_merge_insert_action_group (merge, action_group, 0);
g_signal_connect (merge, "add_widget", G_CALLBACK (add_widget), table);
merge = gtk_ui_manager_new ();
gtk_ui_manager_insert_action_group (merge, action_group, 0);
gtk_window_add_accel_group (GTK_WINDOW (window),
gtk_menu_merge_get_accel_group (merge));
gtk_ui_manager_get_accel_group (merge));
if (!gtk_menu_merge_add_ui_from_string (merge, ui_info, -1, &error))
if (!gtk_ui_manager_add_ui_from_string (merge, ui_info, -1, &error))
{
g_message ("building menus failed: %s", error->message);
g_error_free (error);
}
bar = gtk_ui_manager_get_widget (merge, "/MenuBar");
gtk_widget_show (bar);
gtk_table_attach (GTK_TABLE (table),
bar,
/* X direction */ /* Y direction */
0, 1, 0, 1,
GTK_EXPAND | GTK_FILL, 0,
0, 0);
bar = gtk_ui_manager_get_widget (merge, "/ToolBar");
gtk_widget_show (bar);
gtk_table_attach (GTK_TABLE (table),
bar,
/* X direction */ /* Y direction */
0, 1, 1, 2,
GTK_EXPAND | GTK_FILL, 0,
0, 0);
/* Create document
*/
......
......@@ -167,7 +167,6 @@ gtk_public_h_sources = \
gtkmenu.h \
gtkmenubar.h \
gtkmenuitem.h \
gtkmenumerge.h \
gtkmenushell.h \
gtkmessagedialog.h \
gtkmisc.h \
......@@ -236,6 +235,7 @@ gtk_public_h_sources = \
gtktreeview.h \
gtktreeviewcolumn.h \
gtktypeutils.h \
gtkuimanager.h \
gtkvbbox.h \
gtkvbox.h \
gtkviewport.h \
......@@ -358,7 +358,6 @@ gtk_c_sources = \
gtkmarshalers.c \
gtkmarshal.c \
gtkmenu.c \
gtkmenumerge.c \
gtkmenubar.c \
gtkmenuitem.c \
gtkmenushell.c \
......@@ -429,6 +428,7 @@ gtk_c_sources = \
gtktreeviewcolumn.c \
gtktypebuiltins.c \
gtktypeutils.c \
gtkuimanager.c \
gtkvbbox.c \
gtkvbox.c \
gtkviewport.c \
......
......@@ -105,7 +105,6 @@
#include <gtk/gtkmenu.h>
#include <gtk/gtkmenubar.h>
#include <gtk/gtkmenuitem.h>
#include <gtk/gtkmenumerge.h>
#include <gtk/gtkmenushell.h>
#include <gtk/gtkmessagedialog.h>
#include <gtk/gtkmisc.h>
......@@ -166,6 +165,7 @@
#include <gtk/gtktreeview.h>
#include <gtk/gtktreeviewcolumn.h>
#include <gtk/gtktypeutils.h>
#include <gtk/gtkuimanager.h>
#include <gtk/gtkvbbox.h>
#include <gtk/gtkvbox.h>
#include <gtk/gtkversion.h>
......
This diff is collapsed.
......@@ -27,8 +27,8 @@
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GTK_MENU_MERGE_H__
#define __GTK_MENU_MERGE_H__
#ifndef __GTK_UI_MANAGER_H__
#define __GTK_UI_MANAGER_H__
#include <glib.h>
......@@ -38,32 +38,32 @@
#include <gtk/gtkaction.h>
#include <gtk/gtkactiongroup.h>
#define GTK_TYPE_MENU_MERGE (gtk_menu_merge_get_type ())
#define GTK_MENU_MERGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MENU_MERGE, GtkMenuMerge))
#define GTK_MENU_MERGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MENU_MERGE, GtkMenuMergeClass))
#define GTK_IS_MENU_MERGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MENU_MERGE))
#define GTK_IS_MENU_MERGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), GTK_TYPE_MENU_MERGE))
#define GTK_MENU_MERGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_MENU_MERGE, GtkMenuMergeClass))
#define GTK_TYPE_UI_MANAGER (gtk_ui_manager_get_type ())
#define GTK_UI_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_UI_MANAGER, GtkMenuMerge))
#define GTK_UI_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_UI_MANAGER, GtkUIManagerClass))
#define GTK_IS_UI_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_UI_MANAGER))
#define GTK_IS_UI_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), GTK_TYPE_UI_MANAGER))
#define GTK_UI_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_UI_MANAGER, GtkUIManagerClass))
typedef struct _GtkMenuMerge GtkMenuMerge;
typedef struct _GtkMenuMergeClass GtkMenuMergeClass;
typedef struct _GtkMenuMergePrivate GtkMenuMergePrivate;
typedef struct _GtkUIManager GtkUIManager;
typedef struct _GtkUIManagerClass GtkUIManagerClass;
typedef struct _GtkUIManagerPrivate GtkUIManagerPrivate;
struct _GtkMenuMerge {
struct _GtkUIManager {
GObject parent;
/*< private >*/
GtkMenuMergePrivate *private_data;
GtkUIManagerPrivate *private_data;
};
struct _GtkMenuMergeClass {
struct _GtkUIManagerClass {
GObjectClass parent_class;
void (* add_widget) (GtkMenuMerge *merge,
void (* add_widget) (GtkUIManager *merge,
GtkWidget *widget);
void (* remove_widget) (GtkMenuMerge *merge,
void (* remove_widget) (GtkUIManager *merge,
GtkWidget *widget);
/* Padding for future expansion */
......@@ -73,37 +73,37 @@ struct _GtkMenuMergeClass {
void (*_gtk_reserved4) (void);
};
GType gtk_menu_merge_get_type (void);
GtkMenuMerge *gtk_menu_merge_new (void);
GType gtk_ui_manager_get_type (void);
GtkUIManager *gtk_ui_manager_new (void);
/* these two functions will dirty all merge nodes, as they may need to
* be connected up to different actions */
void gtk_menu_merge_insert_action_group (GtkMenuMerge *self,
GtkActionGroup *action_group,
gint pos);
void gtk_menu_merge_remove_action_group (GtkMenuMerge *self,
GtkActionGroup *action_group);
GList *gtk_menu_merge_get_action_groups (GtkMenuMerge *self);
GtkAccelGroup *gtk_menu_merge_get_accel_group (GtkMenuMerge *self);
void gtk_ui_manager_insert_action_group (GtkUIManager *self,
GtkActionGroup *action_group,
gint pos);
void gtk_ui_manager_remove_action_group (GtkUIManager *self,
GtkActionGroup *action_group);
GList *gtk_ui_manager_get_action_groups (GtkUIManager *self);
GtkAccelGroup *gtk_ui_manager_get_accel_group (GtkUIManager *self);
GtkWidget *gtk_menu_merge_get_widget (GtkMenuMerge *self,
const gchar *path);
GtkWidget *gtk_ui_manager_get_widget (GtkUIManager *self,
const gchar *path);
/* these two functions are for adding UI elements to the merged user
* interface */
guint gtk_menu_merge_add_ui_from_string (GtkMenuMerge *self,
const gchar *buffer,
gsize length,
GError **error);
guint gtk_menu_merge_add_ui_from_file (GtkMenuMerge *self,
const gchar *filename,
GError **error);
void gtk_menu_merge_remove_ui (GtkMenuMerge *self,
guint merge_id);
guint gtk_ui_manager_add_ui_from_string (GtkUIManager *self,
const gchar *buffer,
gsize length,
GError **error);
guint gtk_ui_manager_add_ui_from_file (GtkUIManager *self,
const gchar *filename,
GError **error);
void gtk_ui_manager_remove_ui (GtkUIManager *self,
guint merge_id);
gchar *gtk_menu_merge_get_ui (GtkMenuMerge *self);
gchar *gtk_ui_manager_get_ui (GtkUIManager *self);
#endif /* __GTK_MENU_MERGE_H__ */
#endif /* __GTK_UI_MANAGER_H__ */
......@@ -195,7 +195,7 @@ static const gchar *ui_info =
"</Root>\n";
static void
add_widget (GtkMenuMerge *merge,
add_widget (GtkUIManager *merge,
GtkWidget *widget,
GtkContainer *container)
{
......@@ -213,7 +213,7 @@ add_widget (GtkMenuMerge *merge,
static void
create_window (GtkActionGroup *action_group)
{
GtkMenuMerge *merge;
GtkUIManager *merge;
GtkWidget *window;
GtkWidget *box;
GError *error = NULL;
......@@ -227,14 +227,14 @@ create_window (GtkActionGroup *action_group)
gtk_container_add (GTK_CONTAINER (window), box);
gtk_widget_show (box);
merge = gtk_menu_merge_new ();
gtk_menu_merge_insert_action_group (merge, action_group, 0);
merge = gtk_ui_manager_new ();
gtk_ui_manager_insert_action_group (merge, action_group, 0);
g_signal_connect (merge, "add_widget", G_CALLBACK (add_widget), box);
gtk_window_add_accel_group (GTK_WINDOW (window),
gtk_menu_merge_get_accel_group (merge));
gtk_ui_manager_get_accel_group (merge));
if (!gtk_menu_merge_add_ui_from_string (merge, ui_info, -1, &error))
if (!gtk_ui_manager_add_ui_from_string (merge, ui_info, -1, &error))
{
g_message ("building menus failed: %s", error->message);
g_error_free (error);
......
......@@ -15,11 +15,11 @@ struct { const gchar *filename; guint merge_id; } merge_ids[] = {
static void
dump_tree (GtkWidget *button,
GtkMenuMerge *merge)
GtkUIManager *merge)
{
gchar *dump;
dump = gtk_menu_merge_get_ui (merge);
dump = gtk_ui_manager_get_ui (merge);
g_message (dump);
g_free (dump);
}
......@@ -82,7 +82,7 @@ static GtkActionGroupEntry entries[] = {
static guint n_entries = G_N_ELEMENTS (entries);
static void
add_widget (GtkMenuMerge *merge,
add_widget (GtkUIManager *merge,
GtkWidget *widget,
GtkBox *box)
{
......@@ -92,7 +92,7 @@ add_widget (GtkMenuMerge *merge,
static void
toggle_merge (GtkWidget *button,
GtkMenuMerge *merge)
GtkUIManager *merge)
{
gint mergenum;
......@@ -104,7 +104,7 @@ toggle_merge (GtkWidget *button,
g_message ("merging %s", merge_ids[mergenum].filename);
merge_ids[mergenum].merge_id =
gtk_menu_merge_add_ui_from_file (merge, merge_ids[mergenum].filename, &err);
gtk_ui_manager_add_ui_from_file (merge, merge_ids[mergenum].filename, &err);
if (err != NULL)
{
GtkWidget *dialog;
......@@ -124,7 +124,7 @@ toggle_merge (GtkWidget *button,
{
g_message ("unmerging %s (merge_id=%u)", merge_ids[mergenum].filename,
merge_ids[mergenum].merge_id);
gtk_menu_merge_remove_ui (merge, merge_ids[mergenum].merge_id);
gtk_ui_manager_remove_ui (merge, merge_ids[mergenum].merge_id);
}
}
......@@ -252,7 +252,7 @@ iter_compare_func (GtkTreeModel *model,
}
static GtkWidget *
create_tree_view (GtkMenuMerge *merge)
create_tree_view (GtkUIManager *merge)
{
GtkWidget *tree_view, *sw;
GtkListStore *store;
......@@ -265,7 +265,7 @@ create_tree_view (GtkMenuMerge *merge)
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store), 0,
GTK_SORT_ASCENDING);
for (p = gtk_menu_merge_get_action_groups (merge); p; p = p->next)
for (p = gtk_ui_manager_get_action_groups (merge); p; p = p->next)
{
GList *actions, *l;
......@@ -315,14 +315,14 @@ create_tree_view (GtkMenuMerge *merge)
static gboolean
area_press (GtkWidget *drawing_area,
GdkEventButton *event,
GtkMenuMerge *merge)
GtkUIManager *merge)
{
gtk_widget_grab_focus (drawing_area);
if (event->button == 3 &&
event->type == GDK_BUTTON_PRESS)
{
GtkWidget *menu = gtk_menu_merge_get_widget (merge, "/popups/FileMenu");
GtkWidget *menu = gtk_ui_manager_get_widget (merge, "/popups/FileMenu");
if (GTK_IS_MENU (menu))
{
......@@ -341,7 +341,7 @@ int
main (int argc, char **argv)
{
GtkActionGroup *action_group;
GtkMenuMerge *merge;
GtkUIManager *merge;
GtkWidget *window, *table, *frame, *menu_box, *vbox, *view, *area;
GtkWidget *button;
gint i;
......@@ -375,16 +375,16 @@ main (int argc, char **argv)
gtk_box_pack_end (GTK_BOX (menu_box), area, FALSE, FALSE, 0);
gtk_widget_show (area);
merge = gtk_menu_merge_new ();
merge = gtk_ui_manager_new ();
g_signal_connect (area, "button_press_event",
G_CALLBACK (area_press), merge);
gtk_menu_merge_insert_action_group (merge, action_group, 0);
gtk_ui_manager_insert_action_group (merge, action_group, 0);
g_signal_connect (merge, "add_widget", G_CALLBACK (add_widget), menu_box);
gtk_window_add_accel_group (GTK_WINDOW (window),
gtk_menu_merge_get_accel_group (merge));
gtk_ui_manager_get_accel_group (merge));
frame = gtk_frame_new ("UI Files");
gtk_table_attach (GTK_TABLE (table), frame, 0,1, 0,1,
......
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