From: Christian Dywan Date: Wed, 28 Jan 2009 23:52:27 +0000 (+0100) Subject: Implement KatzeSeparatorAction X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a89a178a051a5954a5a7ff7564d65b2f39e6ab68;p=midori Implement KatzeSeparatorAction --- diff --git a/katze/katze-arrayaction.c b/katze/katze-arrayaction.c index fe3657d2..0ff5f1c4 100644 --- a/katze/katze-arrayaction.c +++ b/katze/katze-arrayaction.c @@ -31,7 +31,7 @@ struct _KatzeArrayActionClass GtkActionClass parent_class; }; -G_DEFINE_TYPE (KatzeArrayAction, katze_array_action, GTK_TYPE_ACTION) +G_DEFINE_TYPE (KatzeArrayAction, katze_array_action, GTK_TYPE_ACTION); enum { diff --git a/katze/katze-separatoraction.c b/katze/katze-separatoraction.c new file mode 100644 index 00000000..1b86a8c2 --- /dev/null +++ b/katze/katze-separatoraction.c @@ -0,0 +1,134 @@ +/* + Copyright (C) 2009 Christian Dywan + + This library 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.1 of the License, or (at your option) any later version. + + See the file COPYING for the full license text. +*/ + +#include "katze-separatoraction.h" + +struct _KatzeSeparatorAction +{ + GtkAction parent_instance; +}; + +struct _KatzeSeparatorActionClass +{ + GtkActionClass parent_class; +}; + +G_DEFINE_TYPE (KatzeSeparatorAction, katze_separator_action, GTK_TYPE_ACTION); + +static void +katze_separator_action_finalize (GObject* object); + +static void +katze_separator_action_activate (GtkAction* object); + +static GtkWidget* +katze_separator_action_create_tool_item (GtkAction* action); + +static GtkWidget* +katze_separator_action_create_menu_item (GtkAction* action); + +static void +katze_separator_action_connect_proxy (GtkAction* action, + GtkWidget* proxy); + +static void +katze_separator_action_disconnect_proxy (GtkAction* action, + GtkWidget* proxy); + +static void +katze_separator_action_class_init (KatzeSeparatorActionClass* class) +{ + GObjectClass* gobject_class; + GtkActionClass* action_class; + + gobject_class = G_OBJECT_CLASS (class); + gobject_class->finalize = katze_separator_action_finalize; + + action_class = GTK_ACTION_CLASS (class); + action_class->activate = katze_separator_action_activate; + action_class->create_menu_item = katze_separator_action_create_menu_item; + action_class->create_tool_item = katze_separator_action_create_tool_item; + action_class->connect_proxy = katze_separator_action_connect_proxy; + action_class->disconnect_proxy = katze_separator_action_disconnect_proxy; +} + +static void +katze_separator_action_init (KatzeSeparatorAction* separator_action) +{ + /* Nothing to do. */ +} + +static void +katze_separator_action_finalize (GObject* object) +{ + G_OBJECT_CLASS (katze_separator_action_parent_class)->finalize (object); +} + +static void +katze_separator_action_activate (GtkAction* action) +{ + GSList* proxies; + + proxies = gtk_action_get_proxies (action); + if (!proxies) + return; + + do + if (GTK_IS_TOOL_ITEM (proxies->data)) + { + + } + while ((proxies = g_slist_next (proxies))); + + if (GTK_ACTION_CLASS (katze_separator_action_parent_class)->activate) + GTK_ACTION_CLASS (katze_separator_action_parent_class)->activate (action); +} + +static GtkWidget* +katze_separator_action_create_menu_item (GtkAction* action) +{ + GtkWidget* menuitem; + + menuitem = gtk_separator_menu_item_new (); + return menuitem; +} + +static GtkWidget* +katze_separator_action_create_tool_item (GtkAction* action) +{ + GtkWidget* toolitem; + + toolitem = GTK_WIDGET (gtk_separator_tool_item_new ()); + return toolitem; +} + +static void +katze_separator_action_connect_proxy (GtkAction* action, + GtkWidget* proxy) +{ + GTK_ACTION_CLASS (katze_separator_action_parent_class)->connect_proxy ( + action, proxy); + + if (GTK_IS_TOOL_ITEM (proxy)) + { + } + else if (GTK_IS_MENU_ITEM (proxy)) + { + } +} + +static void +katze_separator_action_disconnect_proxy (GtkAction* action, + GtkWidget* proxy) +{ + GTK_ACTION_CLASS (katze_separator_action_parent_class)->disconnect_proxy + (action, proxy); +} diff --git a/katze/katze-separatoraction.h b/katze/katze-separatoraction.h new file mode 100644 index 00000000..396b83d8 --- /dev/null +++ b/katze/katze-separatoraction.h @@ -0,0 +1,43 @@ +/* + Copyright (C) 2009 Christian Dywan + + This library 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.1 of the License, or (at your option) any later version. + + See the file COPYING for the full license text. +*/ + +#ifndef __KATZE_SEPARATOR_ACTION_H__ +#define __KATZE_SEPARATOR_ACTION_H__ + +#include + +G_BEGIN_DECLS + +#define KATZE_TYPE_SEPARATOR_ACTION \ + (katze_separator_action_get_type ()) +#define KATZE_SEPARATOR_ACTION(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), KATZE_TYPE_SEPARATOR_ACTION, \ + KatzeSeparatorAction)) +#define KATZE_SEPARATOR_ACTION_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST ((klass), KATZE_TYPE_SEPARATOR_ACTION, \ + KatzeSeparatorActionClass)) +#define KATZE_IS_SEPARATOR_ACTION(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KATZE_TYPE_SEPARATOR_ACTION)) +#define KATZE_IS_SEPARATOR_ACTION_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE ((klass), KATZE_TYPE_SEPARATOR_ACTION)) +#define KATZE_SEPARATOR_ACTION_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), KATZE_TYPE_SEPARATOR_ACTION, \ + KatzeSeparatorActionClass)) + +typedef struct _KatzeSeparatorAction KatzeSeparatorAction; +typedef struct _KatzeSeparatorActionClass KatzeSeparatorActionClass; + +GType +katze_separator_action_get_type (void); + +G_END_DECLS + +#endif /* __KATZE_SEPARATOR_ACTION_H__ */ diff --git a/katze/katze.h b/katze/katze.h index a4cf626a..474a8b4a 100644 --- a/katze/katze.h +++ b/katze/katze.h @@ -18,6 +18,7 @@ #include "katze-list.h" #include "katze-array.h" #include "katze-arrayaction.h" +#include "katze-separatoraction.h" #include "katze-net.h" #endif /* __KATZE_H__ */