aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/Makefile.am2
-rw-r--r--widgets/misc/e-menu-tool-action.c75
-rw-r--r--widgets/misc/e-menu-tool-action.h71
3 files changed, 148 insertions, 0 deletions
diff --git a/widgets/misc/Makefile.am b/widgets/misc/Makefile.am
index bf6291a0b2..d98acf3c2a 100644
--- a/widgets/misc/Makefile.am
+++ b/widgets/misc/Makefile.am
@@ -55,6 +55,7 @@ widgetsinclude_HEADERS = \
e-image-chooser.h \
e-import-assistant.h \
e-map.h \
+ e-menu-tool-action.h \
e-menu-tool-button.h \
e-online-button.h \
e-paned.h \
@@ -133,6 +134,7 @@ libemiscwidgets_la_SOURCES = \
e-image-chooser.c \
e-import-assistant.c \
e-map.c \
+ e-menu-tool-action.c \
e-menu-tool-button.c \
e-online-button.c \
e-paned.c \
diff --git a/widgets/misc/e-menu-tool-action.c b/widgets/misc/e-menu-tool-action.c
new file mode 100644
index 0000000000..2cfe2783db
--- /dev/null
+++ b/widgets/misc/e-menu-tool-action.c
@@ -0,0 +1,75 @@
+/*
+ * e-menu-tool-action.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include "e-menu-tool-action.h"
+
+static gpointer parent_class;
+
+static void
+menu_tool_action_class_init (EMenuToolActionClass *class)
+{
+ GtkActionClass *action_class;
+
+ parent_class = g_type_class_peek_parent (class);
+
+ action_class = GTK_ACTION_CLASS (class);
+ action_class->toolbar_item_type = GTK_TYPE_MENU_TOOL_BUTTON;
+}
+
+GType
+e_menu_tool_action_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0)) {
+ static const GTypeInfo type_info = {
+ sizeof (EMenuToolActionClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) menu_tool_action_class_init,
+ (GClassFinalizeFunc) NULL,
+ NULL, /* class_data */
+ sizeof (EMenuToolAction),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) NULL,
+ NULL /* value_table */
+ };
+
+ type = g_type_register_static (
+ GTK_TYPE_ACTION, "EMenuToolAction", &type_info, 0);
+ }
+
+ return type;
+}
+
+EMenuToolAction *
+e_menu_tool_action_new (const gchar *name,
+ const gchar *label,
+ const gchar *tooltip,
+ const gchar *stock_id)
+{
+ g_return_val_if_fail (name != NULL, NULL);
+
+ return g_object_new (
+ E_TYPE_MENU_TOOL_ACTION,
+ "name", name, "label", label, "tooltip",
+ tooltip, "stock-id", stock_id, NULL);
+}
diff --git a/widgets/misc/e-menu-tool-action.h b/widgets/misc/e-menu-tool-action.h
new file mode 100644
index 0000000000..e642edf958
--- /dev/null
+++ b/widgets/misc/e-menu-tool-action.h
@@ -0,0 +1,71 @@
+/*
+ * e-menu-tool-action.h
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+/* This is a trivial GtkAction subclass that sets the toolbar
+ * item type to GtkMenuToolButton instead of GtkToolButton. */
+
+#ifndef E_MENU_TOOL_ACTION_H
+#define E_MENU_TOOL_ACTION_H
+
+#include <gtk/gtk.h>
+
+/* Standard GObject macros */
+#define E_TYPE_MENU_TOOL_ACTION \
+ (e_menu_tool_action_get_type ())
+#define E_MENU_TOOL_ACTION(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST \
+ ((obj), E_TYPE_MENU_TOOL_ACTION, EMenuToolAction))
+#define E_MENU_TOOL_ACTION_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_CAST \
+ ((cls), E_TYPE_MENU_TOOL_ACTION, EMenuToolActionClass))
+#define E_IS_MENU_TOOL_ACTION(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE \
+ ((obj), E_TYPE_MENU_TOOL_ACTION))
+#define E_IS_MENU_TOOL_ACTION_CLASS(cls) \
+ (G_TYPE_CHECK_CLASS_TYPE \
+ ((cls), E_TYPE_MENU_TOOL_ACTION))
+#define E_MENU_TOOL_ACTION_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS \
+ ((obj), E_TYPE_MENU_TOOL_ACTION, EMenuToolActionClass))
+
+G_BEGIN_DECLS
+
+typedef struct _EMenuToolAction EMenuToolAction;
+typedef struct _EMenuToolActionClass EMenuToolActionClass;
+
+struct _EMenuToolAction {
+ GtkAction parent;
+};
+
+struct _EMenuToolActionClass {
+ GtkActionClass parent_class;
+};
+
+GType e_menu_tool_action_get_type (void);
+EMenuToolAction *
+ e_menu_tool_action_new (const gchar *name,
+ const gchar *label,
+ const gchar *tooltip,
+ const gchar *stock_id);
+
+G_END_DECLS
+
+#endif /* E_MENU_TOOL_ACTION_H */