[Kazehakase-cvs] CVS update: kazehakase/ext/ruby

アーカイブの一覧に戻る

Kouhei Sutou kous****@users*****
Thu Jun 8 22:39:19 JST 2006


Index: kazehakase/ext/ruby/Makefile.am
diff -u kazehakase/ext/ruby/Makefile.am:1.7 kazehakase/ext/ruby/Makefile.am:1.8
--- kazehakase/ext/ruby/Makefile.am:1.7	Mon May 29 19:46:47 2006
+++ kazehakase/ext/ruby/Makefile.am	Thu Jun  8 22:39:18 2006
@@ -45,6 +45,7 @@
 libkzext_la_SOURCES = \
 	kz-rb-ext.c kz-rb-ext.h \
 	kz-rb-window.c \
+	kz-rb-statusbar.c \
 	kz-rb-embed.c \
 	kz-rb-embed-event.c \
 	kz-rb-conf.c \
Index: kazehakase/ext/ruby/kz-rb-ext.c
diff -u kazehakase/ext/ruby/kz-rb-ext.c:1.14 kazehakase/ext/ruby/kz-rb-ext.c:1.15
--- kazehakase/ext/ruby/kz-rb-ext.c:1.14	Thu May 25 00:00:38 2006
+++ kazehakase/ext/ruby/kz-rb-ext.c	Thu Jun  8 22:39:18 2006
@@ -131,6 +131,7 @@
 
     if (RTEST(rb_const_get(mKz, rb_intern("ENABLE")))) {
         Init_kz_rb_window(mKz);
+        Init_kz_rb_statusbar(mKz);
         Init_kz_rb_embed(mKz);
         Init_kz_rb_embed_event(mKz);
         Init_kz_rb_conf(mKz);
Index: kazehakase/ext/ruby/kz-rb-ext.h
diff -u kazehakase/ext/ruby/kz-rb-ext.h:1.9 kazehakase/ext/ruby/kz-rb-ext.h:1.10
--- kazehakase/ext/ruby/kz-rb-ext.h:1.9	Mon May 29 19:27:07 2006
+++ kazehakase/ext/ruby/kz-rb-ext.h	Thu Jun  8 22:39:18 2006
@@ -11,6 +11,7 @@
 #undef PACKAGE_VERSION
 
 #include "kz-window.h"
+#include "kz-statusbar.h"
 #include "kz-downloader.h"
 #include "kz-downloader-group.h"
 #include "kz-enum-types.h"
@@ -29,6 +30,7 @@
 extern void kz_ext_setup(KzWindow *kz);
 extern void kz_ext_exit(gboolean success);
 extern void Init_kz_rb_window(VALUE mKz);
+extern void Init_kz_rb_statusbar(VALUE mKz);
 extern void Init_kz_rb_embed(VALUE mKz);
 extern void Init_kz_rb_embed_event(VALUE mKz);
 extern void Init_kz_rb_conf(VALUE mKz);
Index: kazehakase/ext/ruby/kz-rb-statusbar.c
diff -u /dev/null kazehakase/ext/ruby/kz-rb-statusbar.c:1.1
--- /dev/null	Thu Jun  8 22:39:19 2006
+++ kazehakase/ext/ruby/kz-rb-statusbar.c	Thu Jun  8 22:39:18 2006
@@ -0,0 +1,96 @@
+/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
+
+/*
+ *  Copyright (C) 2006 Kouhei Sutou <kou****@cozmi*****>
+ *
+ *  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, 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 "kz-rb-ext.h"
+
+#define _SELF(obj) (KZ_STATUSBAR(RVAL2GOBJ(obj)))
+#define RVAL2GTKWIDGET(obj) (GTK_WIDGET(RVAL2GOBJ(obj)))
+#define RVAL2GTKACTION(obj) (GTK_ACTION(RVAL2GOBJ(obj)))
+#define RVAL2GNODE(obj) (GTK_GNODE(RVAL2GOBJ(obj)))
+#define RVAL2KZBOOKMARK(obj) (KZ_BOOKMARK(RVAL2GOBJ(obj)))
+#define RVAL2KZWINDOW(obj) (KZ_WINDOW(RVAL2GOBJ(obj)))
+
+static VALUE
+rb_kz_statusbar_new(VALUE self, VALUE kz)
+{
+    GtkWidget *statusbar;
+    statusbar = kz_statusbar_new(RVAL2KZWINDOW(kz));
+    RBGTK_INITIALIZE(self, statusbar);
+    return Qnil;
+}
+
+static VALUE
+rb_kz_statusbar_set_text(VALUE self, VALUE rb_text, VALUE id_or_name)
+{
+    gchar *text = NULL;
+
+    if (!NIL_P(rb_text))
+        text = RVAL2CSTR(rb_text);
+
+    if (RTEST(rb_obj_is_kind_of(id_or_name, rb_cString))) {
+        kz_statusbar_set_text_with_name(_SELF(self), text,
+                                        RVAL2CSTR(id_or_name));
+    } else {
+        kz_statusbar_set_text(_SELF(self), text, NUM2UINT(id_or_name));
+    }
+    return Qnil;
+}
+
+static VALUE
+rb_kz_statusbar_set_link_text(VALUE self, VALUE text)
+{
+    kz_statusbar_set_link_text(_SELF(self), RVAL2CSTR(text));
+    return Qnil;
+}
+
+static VALUE
+rb_kz_statusbar_set_gesture_text(VALUE self, VALUE text)
+{
+    kz_statusbar_set_gesture_text(_SELF(self), RVAL2CSTR(text));
+    return Qnil;
+}
+
+static VALUE
+rb_kz_statusbar_set_focus_to_find_area(VALUE self)
+{
+    kz_statusbar_set_focus_to_find_area(_SELF(self));
+    return Qnil;
+}
+
+
+void
+Init_kz_rb_statusbar(VALUE mKz)
+{
+    VALUE cKzStatusbar;
+
+    cKzStatusbar = G_DEF_CLASS(KZ_TYPE_STATUSBAR, "Statusbar", mKz);
+
+    rb_define_method(cKzStatusbar, "initialize", rb_kz_statusbar_new, 1);
+
+    rb_define_method(cKzStatusbar, "set_text", rb_kz_statusbar_set_text, 2);
+    rb_define_method(cKzStatusbar, "set_link_text",
+                     rb_kz_statusbar_set_link_text, 1);
+    rb_define_method(cKzStatusbar, "set_gesture_text",
+                     rb_kz_statusbar_set_gesture_text, 1);
+    rb_define_method(cKzStatusbar, "set_focus_to_find_area",
+                     rb_kz_statusbar_set_focus_to_find_area, 0);
+
+    G_DEF_SETTERS(cKzStatusbar);
+}
Index: kazehakase/ext/ruby/kz-rb-window.c
diff -u kazehakase/ext/ruby/kz-rb-window.c:1.10 kazehakase/ext/ruby/kz-rb-window.c:1.11
--- kazehakase/ext/ruby/kz-rb-window.c:1.10	Thu May 25 00:00:38 2006
+++ kazehakase/ext/ruby/kz-rb-window.c	Thu Jun  8 22:39:18 2006
@@ -44,7 +44,7 @@
 rb_kz_window_get_window_list(VALUE self)
 {
     GList *list;
-    list = kz_window_get_window_list();
+    list = (GList *)kz_window_get_window_list();
     return GLIST2ARY(list);
 }
 


More information about the Kazehakase-cvs mailing list
アーカイブの一覧に戻る