[Xfce4-commits] <midori:master> Rewrite Katze.SeparatorAction in Vala

Christian Dywan noreply at xfce.org
Sat Mar 23 03:18:04 CET 2013


Updating branch refs/heads/master
         to c155bb3c33e4a45442648cdc77993bad7a70221d (commit)
       from 38c5d6a5c91fb52d539e0ae6ae19377b206852f4 (commit)

commit c155bb3c33e4a45442648cdc77993bad7a70221d
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sat Mar 23 02:38:17 2013 +0100

    Rewrite Katze.SeparatorAction in Vala

 katze/katze-separatoraction.c    |  134 --------------------------------------
 katze/katze-separatoraction.h    |   43 ------------
 katze/katze-separatoraction.vala |   28 ++++++++
 katze/katze.h                    |    1 -
 po/POTFILES.in                   |    2 +-
 5 files changed, 29 insertions(+), 179 deletions(-)

diff --git a/katze/katze-separatoraction.c b/katze/katze-separatoraction.c
deleted file mode 100644
index 1b86a8c..0000000
--- a/katze/katze-separatoraction.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- Copyright (C) 2009 Christian Dywan <christian at twotoasts.de>
-
- 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
deleted file mode 100644
index 084eebf..0000000
--- a/katze/katze-separatoraction.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- Copyright (C) 2009 Christian Dywan <christian at twotoasts.de>
-
- 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 <gtk/gtk.h>
-
-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_GNUC_CONST;
-
-G_END_DECLS
-
-#endif /* __KATZE_SEPARATOR_ACTION_H__ */
diff --git a/katze/katze-separatoraction.vala b/katze/katze-separatoraction.vala
new file mode 100644
index 0000000..8b377e0
--- /dev/null
+++ b/katze/katze-separatoraction.vala
@@ -0,0 +1,28 @@
+/*
+ Copyright (C) 2009-2013 Christian Dywan <christian at twotoasts.de>
+
+ 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.
+*/
+
+namespace Katze {
+    public class SeparatorAction : Gtk.Action {
+        Gtk.MenuItem? menuitem = null;
+        Gtk.ToolItem? toolitem = null;
+
+        public override unowned Gtk.Widget create_menu_item () {
+            menuitem = new Gtk.SeparatorMenuItem ();
+            return menuitem;
+        }
+
+        public override unowned Gtk.Widget create_tool_item () {
+            toolitem = new Gtk.SeparatorToolItem ();
+            return toolitem;
+        }
+    }
+}
+
diff --git a/katze/katze.h b/katze/katze.h
index 773a5f1..0a0a31d 100644
--- a/katze/katze.h
+++ b/katze/katze.h
@@ -20,7 +20,6 @@
 #include "katze-item.h"
 #include "katze-array.h"
 #include "katze-arrayaction.h"
-#include "katze-separatoraction.h"
 #include "katze-net.h"
 #include "katze-preferences.h"
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a9cad0a..2d79251 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -63,7 +63,7 @@ extensions/toolbar-editor.c
 extensions/web-cache.c
 katze/katze-net.c
 katze/midori-hsts.vala
-katze/katze-separatoraction.c
+katze/katze-separatoraction.vala
 katze/gtk3-compat.c
 katze/katze-http-cookies-sqlite.c
 katze/katze-http-cookies.c


More information about the Xfce4-commits mailing list