Benjamin Otte
2007-Aug-09 12:24 UTC
[Swfdec] Branch 'vivi' - 6 commits - configure.ac vivified/core vivified/dock vivified/Makefile.am vivified/ui
configure.ac | 1 vivified/Makefile.am | 2 vivified/core/vivi_application.c | 7 + vivified/dock/.gitignore | 12 ++ vivified/dock/Makefile.am | 15 +++ vivified/dock/vivi_docker.c | 93 +++++++++++++++++++ vivified/dock/vivi_docker.h | 55 +++++++++++ vivified/dock/vivi_docklet.c | 172 +++++++++++++++++++++++++++++++++++ vivified/dock/vivi_docklet.h | 61 ++++++++++++ vivified/dock/vivi_vdock.c | 190 +++++++++++++++++++++++++++++++++++++++ vivified/dock/vivi_vdock.h | 54 +++++++++++ vivified/dock/vivified-dock.h | 26 +++++ vivified/ui/Makefile.am | 10 +- vivified/ui/main.c | 25 +---- vivified/ui/vivi_commandline.c | 75 +++++++++++++++ vivified/ui/vivi_commandline.h | 54 +++++++++++ 16 files changed, 828 insertions(+), 24 deletions(-) New commits: diff-tree e506ea7bfceb2b1a0a9237141d6137cf39110233 (from 555b7cbb3f3edd2e9c5293e8c8d5d1f9b6012531) Author: Benjamin Otte <otte at gnome.org> Date: Thu Aug 9 14:24:12 2007 +0200 implement size_request, size_allocate and foreach why does GtkBin not implement this? diff --git a/vivified/dock/vivi_docklet.c b/vivified/dock/vivi_docklet.c index 42c8aa2..f6bc015 100644 --- a/vivified/dock/vivi_docklet.c +++ b/vivified/dock/vivi_docklet.c @@ -81,9 +81,34 @@ vivi_docklet_dispose (GObject *object) } static void +vivi_docklet_size_request (GtkWidget *widget, GtkRequisition *req) +{ + GtkWidget *child = GTK_BIN (widget)->child; + + if (child) { + gtk_widget_size_request (child, req); + } else { + req->width = req->height = 0; + } +} + +static void +vivi_docklet_size_allocate (GtkWidget *widget, GtkAllocation *allocation) +{ + GtkWidget *child = GTK_BIN (widget)->child; + + GTK_WIDGET_CLASS (vivi_docklet_parent_class)->size_allocate (widget, allocation); + + if (child && GTK_WIDGET_VISIBLE (child)) { + gtk_widget_size_allocate (child, allocation); + } +} + +static void vivi_docklet_class_init (ViviDockletClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); object_class->dispose = vivi_docklet_dispose; object_class->get_property = vivi_docklet_get_property; @@ -95,6 +120,9 @@ vivi_docklet_class_init (ViviDockletClas g_object_class_install_property (object_class, PROP_ICON, g_param_spec_string ("icon", "icon", "name of the icon to display", GTK_STOCK_MISSING_IMAGE, G_PARAM_READWRITE)); + + widget_class->size_request = vivi_docklet_size_request; + widget_class->size_allocate = vivi_docklet_size_allocate; } static void diff --git a/vivified/dock/vivi_vdock.c b/vivified/dock/vivi_vdock.c index 6ade29a..1559ec1 100644 --- a/vivified/dock/vivi_vdock.c +++ b/vivified/dock/vivi_vdock.c @@ -39,6 +39,30 @@ vivi_vdock_dispose (GObject *object) } static void +vivi_vdock_size_request (GtkWidget *widget, GtkRequisition *req) +{ + GtkWidget *child = GTK_BIN (widget)->child; + + if (child) { + gtk_widget_size_request (child, req); + } else { + req->width = req->height = 0; + } +} + +static void +vivi_vdock_size_allocate (GtkWidget *widget, GtkAllocation *allocation) +{ + GtkWidget *child = GTK_BIN (widget)->child; + + GTK_WIDGET_CLASS (vivi_vdock_parent_class)->size_allocate (widget, allocation); + + if (child && GTK_WIDGET_VISIBLE (child)) { + gtk_widget_size_allocate (child, allocation); + } +} + +static void vivi_vdock_add (GtkContainer *container, GtkWidget *widget) { ViviVDock *vdock = VIVI_VDOCK (container); @@ -119,16 +143,37 @@ vivi_vdock_child_type (GtkContainer *con } static void +vivi_vdock_forall (GtkContainer *container, gboolean include_internals, + GtkCallback callback, gpointer callback_data) +{ + if (include_internals) { + GTK_CONTAINER_CLASS (vivi_vdock_parent_class)->forall (container, include_internals, + callback, callback_data); + } else { + GList *walk; + + for (walk = VIVI_VDOCK (container)->docklets; walk; walk = walk->next) { + callback (walk->data, callback_data); + } + } +} + +static void vivi_vdock_class_init (ViviVDockClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass); object_class->dispose = vivi_vdock_dispose; + widget_class->size_request = vivi_vdock_size_request; + widget_class->size_allocate = vivi_vdock_size_allocate; + container_class->add = vivi_vdock_add; container_class->remove = vivi_vdock_remove; container_class->child_type = vivi_vdock_child_type; + container_class->forall = vivi_vdock_forall; } static void diff-tree 555b7cbb3f3edd2e9c5293e8c8d5d1f9b6012531 (from 5764ac047bfb06bcac2f20541dad99ad4423bace) Author: Benjamin Otte <otte at gnome.org> Date: Thu Aug 9 14:21:48 2007 +0200 use LDADD for including our own libraries diff --git a/vivified/ui/Makefile.am b/vivified/ui/Makefile.am index 83d58f3..5509035 100644 --- a/vivified/ui/Makefile.am +++ b/vivified/ui/Makefile.am @@ -1,7 +1,8 @@ noinst_PROGRAMS = vivified vivified_CFLAGS = $(GLOBAL_CFLAGS) $(SWFDEC_GTK_CFLAGS) -vivified_LDFLAGS = $(SWFDEC_GTK_LIBS) \ +vivified_LDFLAGS = $(SWFDEC_GTK_LIBS) +vivified_LDADD = \ $(top_builddir)/vivified/core/libvivified-core.la \ $(top_builddir)/vivified/dock/libvivified-dock.la diff-tree 5764ac047bfb06bcac2f20541dad99ad4423bace (from 2e41ba5f7b9b9e1e2ae7b2e6301597b5295d186b) Author: Benjamin Otte <otte at gnome.org> Date: Thu Aug 9 14:21:26 2007 +0200 show the newly added widgets diff --git a/vivified/dock/vivi_docker.c b/vivified/dock/vivi_docker.c index 77a3839..90a0de9 100644 --- a/vivified/dock/vivi_docker.c +++ b/vivified/dock/vivi_docker.c @@ -69,7 +69,9 @@ vivi_docker_set_docklet (ViviDocker *doc g_return_if_fail (VIVI_IS_DOCKLET (docklet)); box = gtk_hbox_new (FALSE, 3); + gtk_widget_show (box); widget = gtk_label_new (vivi_docklet_get_title (docklet)); + gtk_widget_show (widget); g_signal_connect (docklet, "notify::title", G_CALLBACK (vivi_docker_docklet_notify_title), widget); gtk_box_pack_start (GTK_BOX (box), widget, TRUE, TRUE, 0); gtk_expander_set_label_widget (GTK_EXPANDER (docker), box); diff-tree 2e41ba5f7b9b9e1e2ae7b2e6301597b5295d186b (from 3c9914ddfb97b6c3d9a25c1651337e85aa4e9c4c) Author: Benjamin Otte <otte at gnome.org> Date: Thu Aug 9 13:53:49 2007 +0200 add simple command line entry for testing the doc diff --git a/vivified/ui/Makefile.am b/vivified/ui/Makefile.am index 05e37df..83d58f3 100644 --- a/vivified/ui/Makefile.am +++ b/vivified/ui/Makefile.am @@ -6,7 +6,9 @@ vivified_LDFLAGS = $(SWFDEC_GTK_LIBS) \ $(top_builddir)/vivified/dock/libvivified-dock.la vivified_SOURCES = \ + vivi_commandline.c \ main.c -noinst_HEADERS +noinst_HEADERS = \ + vivi_commandline.h diff --git a/vivified/ui/main.c b/vivified/ui/main.c index 7893e7e..1dd43e6 100644 --- a/vivified/ui/main.c +++ b/vivified/ui/main.c @@ -24,18 +24,8 @@ #include <gtk/gtk.h> #include <libswfdec-gtk/swfdec-gtk.h> #include "vivified/core/vivified-core.h" - -static void -entry_activate_cb (GtkEntry *entry, ViviApplication *app) -{ - const char *text = gtk_entry_get_text (entry); - - if (text[0] == '\0') - return; - - //swfdec_player_manager_execute (manager, text); - gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1); -} +#include "vivified/dock/vivified-dock.h" +#include "vivi_commandline.h" static void setup (const char *filename) @@ -45,15 +35,10 @@ setup (const char *filename) app = vivi_application_new (); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - box = gtk_vbox_new (FALSE, 0); + box = vivi_vdock_new (); gtk_container_add (GTK_CONTAINER (window), box); - /* widget displaying the Flash */ - widget = swfdec_gtk_widget_new (NULL); - gtk_box_pack_start (GTK_BOX (box), widget, FALSE, FALSE, 0); - /* text entry */ - widget = gtk_entry_new (); - g_signal_connect (widget, "activate", G_CALLBACK (entry_activate_cb), app); - gtk_box_pack_end (GTK_BOX (box), widget, FALSE, TRUE, 0); + widget = vivi_command_line_new (app); + gtk_container_add (GTK_CONTAINER (box), widget); g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL); gtk_widget_show_all (window); diff --git a/vivified/ui/vivi_commandline.c b/vivified/ui/vivi_commandline.c new file mode 100644 index 0000000..ced3e15 --- /dev/null +++ b/vivified/ui/vivi_commandline.c @@ -0,0 +1,75 @@ +/* Vivified + * Copyright (C) 2007 Benjamin Otte <otte at gnome.org> + * + * 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. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "vivi_commandline.h" + +G_DEFINE_TYPE (ViviCommandLine, vivi_command_line, VIVI_TYPE_DOCKLET) + +static void +vivi_command_line_dispose (GObject *object) +{ + //ViviCommandLine *command_line = VIVI_COMMAND_LINE (object); + + G_OBJECT_CLASS (vivi_command_line_parent_class)->dispose (object); +} + +static void +vivi_command_line_class_init (ViviCommandLineClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->dispose = vivi_command_line_dispose; +} + +static void +command_line_entry_activate_cb (GtkEntry *entry, ViviCommandLine *command_line) +{ + const char *text = gtk_entry_get_text (entry); + + if (text[0] == '\0') + return; + + g_print ("%s\n", text); + //swfdec_player_manager_execute (manager, text); + gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1); +} + +static void +vivi_command_line_init (ViviCommandLine *command_line) +{ + GtkWidget *entry; + + entry = gtk_entry_new (); + gtk_container_add (GTK_CONTAINER (command_line), entry); + g_signal_connect (entry, "activate", G_CALLBACK (command_line_entry_activate_cb), command_line); +} + +GtkWidget * +vivi_command_line_new (ViviApplication *app) +{ + GtkWidget *cl; + + cl = g_object_new (VIVI_TYPE_COMMAND_LINE, "title", "Command Line", NULL); + return cl; +} + diff --git a/vivified/ui/vivi_commandline.h b/vivified/ui/vivi_commandline.h new file mode 100644 index 0000000..f38da32 --- /dev/null +++ b/vivified/ui/vivi_commandline.h @@ -0,0 +1,54 @@ +/* Vivified + * Copyright (C) 2007 Benjamin Otte <otte at gnome.org> + * + * 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. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifndef _VIVI_COMMAND_LINE_H_ +#define _VIVI_COMMAND_LINE_H_ + +#include <vivified/core/vivified-core.h> +#include <vivified/dock/vivified-dock.h> + +G_BEGIN_DECLS + + +typedef struct _ViviCommandLine ViviCommandLine; +typedef struct _ViviCommandLineClass ViviCommandLineClass; + +#define VIVI_TYPE_COMMAND_LINE (vivi_command_line_get_type()) +#define VIVI_IS_COMMAND_LINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIVI_TYPE_COMMAND_LINE)) +#define VIVI_IS_COMMAND_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VIVI_TYPE_COMMAND_LINE)) +#define VIVI_COMMAND_LINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIVI_TYPE_COMMAND_LINE, ViviCommandLine)) +#define VIVI_COMMAND_LINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VIVI_TYPE_COMMAND_LINE, ViviCommandLineClass)) +#define VIVI_COMMAND_LINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VIVI_TYPE_COMMAND_LINE, ViviCommandLineClass)) + +struct _ViviCommandLine { + ViviDocklet docklet; +}; + +struct _ViviCommandLineClass +{ + ViviDockletClass docklet_class; +}; + +GType vivi_command_line_get_type (void); + +GtkWidget * vivi_command_line_new (ViviApplication * app); + + +G_END_DECLS +#endif diff-tree 3c9914ddfb97b6c3d9a25c1651337e85aa4e9c4c (from d16bed72235542b5d4ce5172e0718072f6d340f0) Author: Benjamin Otte <otte at gnome.org> Date: Thu Aug 9 13:53:26 2007 +0200 add vdock widget This is supposed to be a vertical dock. diff --git a/vivified/dock/Makefile.am b/vivified/dock/Makefile.am index 114a137..590e5cf 100644 --- a/vivified/dock/Makefile.am +++ b/vivified/dock/Makefile.am @@ -4,8 +4,12 @@ libvivified_dock_la_CFLAGS = $(GLOBAL_CF libvivified_dock_la_LDFLAGS = $(GTK_LIBS) libvivified_dock_la_SOURCES = \ - vivi_docklet.c + vivi_docker.c \ + vivi_docklet.c \ + vivi_vdock.c noinst_HEADERS = \ + vivi_docker.h \ vivi_docklet.h \ + vivi_vdock.h \ vivified-dock.h diff --git a/vivified/dock/vivi_docker.c b/vivified/dock/vivi_docker.c new file mode 100644 index 0000000..77a3839 --- /dev/null +++ b/vivified/dock/vivi_docker.c @@ -0,0 +1,91 @@ +/* Vivified + * Copyright (C) 2007 Benjamin Otte <otte at gnome.org> + * + * 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. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "vivi_docker.h" + +enum { + REQUEST_CLOSE, + LAST_SIGNAL +}; +static guint signals[LAST_SIGNAL] = { 0, }; + +G_DEFINE_TYPE (ViviDocker, vivi_docker, GTK_TYPE_EXPANDER) + +static void +vivi_docker_dispose (GObject *object) +{ + //ViviDocker *docker = VIVI_DOCKER (object); + + G_OBJECT_CLASS (vivi_docker_parent_class)->dispose (object); +} + +static void +vivi_docker_class_init (ViviDockerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->dispose = vivi_docker_dispose; + + signals[REQUEST_CLOSE] = 0; +} + +static void +vivi_docker_init (ViviDocker *docker) +{ +} + +static void +vivi_docker_docklet_notify_title (ViviDocklet *docklet, GParamSpec *pspec, GtkLabel *label) +{ + gtk_label_set_text (label, vivi_docklet_get_title (docklet)); +} + +static void +vivi_docker_set_docklet (ViviDocker *docker, ViviDocklet *docklet) +{ + GtkWidget *box, *widget; + + g_return_if_fail (VIVI_IS_DOCKER (docker)); + g_return_if_fail (VIVI_IS_DOCKLET (docklet)); + + box = gtk_hbox_new (FALSE, 3); + widget = gtk_label_new (vivi_docklet_get_title (docklet)); + g_signal_connect (docklet, "notify::title", G_CALLBACK (vivi_docker_docklet_notify_title), widget); + gtk_box_pack_start (GTK_BOX (box), widget, TRUE, TRUE, 0); + gtk_expander_set_label_widget (GTK_EXPANDER (docker), box); + gtk_container_add (GTK_CONTAINER (docker), GTK_WIDGET (docklet)); +} + +GtkWidget * +vivi_docker_new (ViviDocklet *docklet) +{ + GtkWidget *widget; + + g_return_val_if_fail (VIVI_IS_DOCKLET (docklet), NULL); + + widget = g_object_new (VIVI_TYPE_DOCKER, "expanded", TRUE, NULL); + vivi_docker_set_docklet (VIVI_DOCKER (widget), docklet); + return widget; +} + + diff --git a/vivified/dock/vivi_docker.h b/vivified/dock/vivi_docker.h new file mode 100644 index 0000000..3baaf8d --- /dev/null +++ b/vivified/dock/vivi_docker.h @@ -0,0 +1,55 @@ +/* Vivified + * Copyright (C) 2007 Benjamin Otte <otte at gnome.org> + * + * 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. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifndef _VIVI_DOCKER_H_ +#define _VIVI_DOCKER_H_ + +#include <gtk/gtk.h> +#include <vivified/dock/vivi_docklet.h> + +G_BEGIN_DECLS + + +typedef struct _ViviDocker ViviDocker; +typedef struct _ViviDockerClass ViviDockerClass; + +#define VIVI_TYPE_DOCKER (vivi_docker_get_type()) +#define VIVI_IS_DOCKER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIVI_TYPE_DOCKER)) +#define VIVI_IS_DOCKER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VIVI_TYPE_DOCKER)) +#define VIVI_DOCKER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIVI_TYPE_DOCKER, ViviDocker)) +#define VIVI_DOCKER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VIVI_TYPE_DOCKER, ViviDockerClass)) +#define VIVI_DOCKER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VIVI_TYPE_DOCKER, ViviDockerClass)) + +struct _ViviDocker { + GtkExpander bin; +}; + +struct _ViviDockerClass +{ + GtkExpanderClass bin_class; + + void (* request_close) (ViviDocker * docker); +}; + +GType vivi_docker_get_type (void); + +GtkWidget * vivi_docker_new (ViviDocklet * docklet); + +G_END_DECLS +#endif diff --git a/vivified/dock/vivi_vdock.c b/vivified/dock/vivi_vdock.c new file mode 100644 index 0000000..6ade29a --- /dev/null +++ b/vivified/dock/vivi_vdock.c @@ -0,0 +1,145 @@ +/* Vivified + * Copyright (C) 2007 Benjamin Otte <otte at gnome.org> + * + * 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. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "vivi_vdock.h" +#include "vivi_docker.h" +#include "vivi_docklet.h" + +G_DEFINE_TYPE (ViviVDock, vivi_vdock, GTK_TYPE_BIN) + +static void +vivi_vdock_dispose (GObject *object) +{ + ViviVDock *vdock = VIVI_VDOCK (object); + + g_list_free (vdock->docklets); + vdock->docklets = NULL; + + G_OBJECT_CLASS (vivi_vdock_parent_class)->dispose (object); +} + +static void +vivi_vdock_add (GtkContainer *container, GtkWidget *widget) +{ + ViviVDock *vdock = VIVI_VDOCK (container); + GtkWidget *docker; + + docker = vivi_docker_new (VIVI_DOCKLET (widget)); + gtk_widget_show (docker); + + g_object_ref (widget); + if (vdock->docklets == NULL) { + GTK_CONTAINER_CLASS (vivi_vdock_parent_class)->add (container, docker); + } else { + /* docklet is in docker */ + GtkWidget *last = gtk_widget_get_parent (vdock->docklets->data); + GtkWidget *parent = gtk_widget_get_parent (last); + GtkWidget *paned; + + g_object_ref (parent); + if (parent == (GtkWidget *) container) { + GTK_CONTAINER_CLASS (vivi_vdock_parent_class)->remove (container, last); + } else { + gtk_container_remove (GTK_CONTAINER (parent), last); + } + paned = gtk_vpaned_new (); + gtk_paned_pack1 (GTK_PANED (paned), docker, TRUE, FALSE); + gtk_paned_pack2 (GTK_PANED (paned), last, TRUE, FALSE); + g_object_unref (last); + gtk_widget_show (paned); + if (parent == (GtkWidget *) container) { + GTK_CONTAINER_CLASS (vivi_vdock_parent_class)->add (container, paned); + } else { + gtk_paned_pack1 (GTK_PANED (parent), paned, TRUE, FALSE); + } + } + vdock->docklets = g_list_prepend (vdock->docklets, widget); +} + +static void +vivi_vdock_remove (GtkContainer *container, GtkWidget *widget) +{ + ViviVDock *vdock = VIVI_VDOCK (container); + GtkWidget *docker, *parent; + + g_return_if_fail (g_list_find (vdock->docklets, widget)); + + docker = gtk_widget_get_parent (widget); + parent = gtk_widget_get_parent (docker); + if (parent == (GtkWidget *) container) { + GTK_CONTAINER_CLASS (vivi_vdock_parent_class)->remove (container, docker); + } else { + GtkWidget *other; + GtkWidget *paned_parent; + g_assert (GTK_IS_PANED (parent)); + paned_parent = gtk_widget_get_parent (parent); + other = gtk_paned_get_child1 (GTK_PANED (parent)); + if (other == docker) + other = gtk_paned_get_child2 (GTK_PANED (parent)); + g_object_ref (other); + gtk_container_remove (GTK_CONTAINER (parent), docker); + gtk_container_remove (GTK_CONTAINER (parent), other); + if (paned_parent == (GtkWidget *) container) { + GTK_CONTAINER_CLASS (vivi_vdock_parent_class)->remove (container, parent); + GTK_CONTAINER_CLASS (vivi_vdock_parent_class)->remove (container, other); + } else { + gtk_container_remove (GTK_CONTAINER (paned_parent), parent); + gtk_paned_pack1 (GTK_PANED (parent), other, TRUE, FALSE); + } + g_object_unref (other); + } + vdock->docklets = g_list_remove (vdock->docklets, widget); + g_object_unref (widget); +} + +static GType +vivi_vdock_child_type (GtkContainer *container) +{ + return VIVI_TYPE_DOCKLET; +} + +static void +vivi_vdock_class_init (ViviVDockClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass); + + object_class->dispose = vivi_vdock_dispose; + + container_class->add = vivi_vdock_add; + container_class->remove = vivi_vdock_remove; + container_class->child_type = vivi_vdock_child_type; +} + +static void +vivi_vdock_init (ViviVDock *vdock) +{ +} + +GtkWidget * +vivi_vdock_new (void) +{ + return g_object_new (VIVI_TYPE_VDOCK, NULL); +} + + diff --git a/vivified/dock/vivi_vdock.h b/vivified/dock/vivi_vdock.h new file mode 100644 index 0000000..ec3527f --- /dev/null +++ b/vivified/dock/vivi_vdock.h @@ -0,0 +1,54 @@ +/* Vivified + * Copyright (C) 2007 Benjamin Otte <otte at gnome.org> + * + * 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. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifndef _VIVI_VDOCK_H_ +#define _VIVI_VDOCK_H_ + +#include <gtk/gtk.h> + +G_BEGIN_DECLS + + +typedef struct _ViviVDock ViviVDock; +typedef struct _ViviVDockClass ViviVDockClass; + +#define VIVI_TYPE_VDOCK (vivi_vdock_get_type()) +#define VIVI_IS_VDOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIVI_TYPE_VDOCK)) +#define VIVI_IS_VDOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VIVI_TYPE_VDOCK)) +#define VIVI_VDOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIVI_TYPE_VDOCK, ViviVDock)) +#define VIVI_VDOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VIVI_TYPE_VDOCK, ViviVDockClass)) +#define VIVI_VDOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VIVI_TYPE_VDOCK, ViviVDockClass)) + +struct _ViviVDock { + GtkBin bin; + + GList * docklets; /* all the docklets that got added to us */ +}; + +struct _ViviVDockClass +{ + GtkBinClass bin_class; +}; + +GType vivi_vdock_get_type (void); + +GtkWidget * vivi_vdock_new (void); + +G_END_DECLS +#endif diff --git a/vivified/dock/vivified-dock.h b/vivified/dock/vivified-dock.h index 401d6c5..244aad8 100644 --- a/vivified/dock/vivified-dock.h +++ b/vivified/dock/vivified-dock.h @@ -21,5 +21,6 @@ #define __VIVIFIED_DOCK_H__ #include <vivified/dock/vivi_docklet.h> +#include <vivified/dock/vivi_vdock.h> #endif diff-tree d16bed72235542b5d4ce5172e0718072f6d340f0 (from d416dd57fbf03e1601e10675dee252259b10f762) Author: Benjamin Otte <otte at gnome.org> Date: Thu Aug 9 11:47:06 2007 +0200 add dock library let' hope that there'll be a GtkDock at some point so we can throw this away. Or someone makes a GtkDock lib out of this :) diff --git a/configure.ac b/configure.ac index 207e360..e9996f4 100644 --- a/configure.ac +++ b/configure.ac @@ -326,6 +326,7 @@ test/trace/Makefile test/various/Makefile vivified/Makefile vivified/core/Makefile +vivified/dock/Makefile vivified/ui/Makefile swfdec.pc swfdec-gtk.pc diff --git a/vivified/Makefile.am b/vivified/Makefile.am index fd20116..8289102 100644 --- a/vivified/Makefile.am +++ b/vivified/Makefile.am @@ -1 +1 @@ -SUBDIRS = core ui +SUBDIRS = core dock ui diff --git a/vivified/core/vivi_application.c b/vivified/core/vivi_application.c index 47a9d96..496eadf 100644 --- a/vivified/core/vivi_application.c +++ b/vivified/core/vivi_application.c @@ -85,6 +85,13 @@ vivi_application_class_init (ViviApplica object_class->dispose = vivi_application_dispose; object_class->get_property = vivi_application_get_property; object_class->set_property = vivi_application_set_property; + + g_object_class_install_property (object_class, PROP_FILENAME, + g_param_spec_string ("filename", "filename", "name of file to play", + NULL, G_PARAM_READWRITE)); + g_object_class_install_property (object_class, PROP_PLAYER, + g_param_spec_object ("player", "player", "Flash player in use", + SWFDEC_TYPE_PLAYER, G_PARAM_READABLE)); } static void diff --git a/vivified/dock/.gitignore b/vivified/dock/.gitignore new file mode 100644 index 0000000..b580c89 --- /dev/null +++ b/vivified/dock/.gitignore @@ -0,0 +1,12 @@ +*~ +CVS +.cvsignore +.deps +.libs + +Makefile +Makefile.in +*.o +*.la +*.lo +*.loT diff --git a/vivified/dock/Makefile.am b/vivified/dock/Makefile.am new file mode 100644 index 0000000..114a137 --- /dev/null +++ b/vivified/dock/Makefile.am @@ -0,0 +1,11 @@ +noinst_LTLIBRARIES = libvivified-dock.la + +libvivified_dock_la_CFLAGS = $(GLOBAL_CFLAGS) $(GTK_CFLAGS) +libvivified_dock_la_LDFLAGS = $(GTK_LIBS) + +libvivified_dock_la_SOURCES = \ + vivi_docklet.c + +noinst_HEADERS = \ + vivi_docklet.h \ + vivified-dock.h diff --git a/vivified/dock/vivi_docklet.c b/vivified/dock/vivi_docklet.c new file mode 100644 index 0000000..42c8aa2 --- /dev/null +++ b/vivified/dock/vivi_docklet.c @@ -0,0 +1,144 @@ +/* Vivified + * Copyright (C) 2007 Benjamin Otte <otte at gnome.org> + * + * 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. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "vivi_docklet.h" + +enum { + PROP_0, + PROP_TITLE, + PROP_ICON +}; + +G_DEFINE_ABSTRACT_TYPE (ViviDocklet, vivi_docklet, GTK_TYPE_BIN) + +static void +vivi_docklet_get_property (GObject *object, guint param_id, GValue *value, + GParamSpec * pspec) +{ + ViviDocklet *docklet = VIVI_DOCKLET (object); + + switch (param_id) { + case PROP_TITLE: + g_value_set_string (value, docklet->title); + break; + case PROP_ICON: + g_value_set_string (value, docklet->icon); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); + break; + } +} + +static void +vivi_docklet_set_property (GObject *object, guint param_id, const GValue *value, + GParamSpec *pspec) +{ + ViviDocklet *docklet = VIVI_DOCKLET (object); + + switch (param_id) { + case PROP_TITLE: + vivi_docklet_set_title (docklet, g_value_get_string (value)); + break; + case PROP_ICON: + vivi_docklet_set_title (docklet, g_value_get_string (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); + break; + } +} + +static void +vivi_docklet_dispose (GObject *object) +{ + ViviDocklet *docklet = VIVI_DOCKLET (object); + + g_free (docklet->title); + g_free (docklet->icon); + + G_OBJECT_CLASS (vivi_docklet_parent_class)->dispose (object); +} + +static void +vivi_docklet_class_init (ViviDockletClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->dispose = vivi_docklet_dispose; + object_class->get_property = vivi_docklet_get_property; + object_class->set_property = vivi_docklet_set_property; + + g_object_class_install_property (object_class, PROP_TITLE, + g_param_spec_string ("title", "title", "title of this docklet", + "Unnamed", G_PARAM_READWRITE)); + g_object_class_install_property (object_class, PROP_ICON, + g_param_spec_string ("icon", "icon", "name of the icon to display", + GTK_STOCK_MISSING_IMAGE, G_PARAM_READWRITE)); +} + +static void +vivi_docklet_init (ViviDocklet *docklet) +{ + docklet->title = g_strdup ("Unnamed"); + docklet->icon = g_strdup (GTK_STOCK_MISSING_IMAGE); +} + +void +vivi_docklet_set_title (ViviDocklet *docklet, const char *title) +{ + g_return_if_fail (VIVI_IS_DOCKLET (docklet)); + g_return_if_fail (title != NULL); + + g_free (docklet->title); + docklet->title = g_strdup (title); + g_object_notify (G_OBJECT (docklet), "title"); +} + +const char * +vivi_docklet_get_title (ViviDocklet *docklet) +{ + g_return_val_if_fail (VIVI_IS_DOCKLET (docklet), NULL); + + return docklet->title; +} + +void +vivi_docklet_set_icon (ViviDocklet *docklet, const char *icon) +{ + g_return_if_fail (VIVI_IS_DOCKLET (docklet)); + g_return_if_fail (icon != NULL); + + g_free (docklet->icon); + docklet->icon = g_strdup (icon); + g_object_notify (G_OBJECT (docklet), "icon"); +} + +const char * +vivi_docklet_get_icon (ViviDocklet *docklet) +{ + g_return_val_if_fail (VIVI_IS_DOCKLET (docklet), NULL); + + return docklet->icon; +} + diff --git a/vivified/dock/vivi_docklet.h b/vivified/dock/vivi_docklet.h new file mode 100644 index 0000000..1088252 --- /dev/null +++ b/vivified/dock/vivi_docklet.h @@ -0,0 +1,61 @@ +/* Vivified + * Copyright (C) 2007 Benjamin Otte <otte at gnome.org> + * + * 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. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifndef _VIVI_DOCKLET_H_ +#define _VIVI_DOCKLET_H_ + +#include <gtk/gtk.h> + +G_BEGIN_DECLS + + +typedef struct _ViviDocklet ViviDocklet; +typedef struct _ViviDockletClass ViviDockletClass; + +#define VIVI_TYPE_DOCKLET (vivi_docklet_get_type()) +#define VIVI_IS_DOCKLET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), VIVI_TYPE_DOCKLET)) +#define VIVI_IS_DOCKLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), VIVI_TYPE_DOCKLET)) +#define VIVI_DOCKLET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), VIVI_TYPE_DOCKLET, ViviDocklet)) +#define VIVI_DOCKLET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), VIVI_TYPE_DOCKLET, ViviDockletClass)) +#define VIVI_DOCKLET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), VIVI_TYPE_DOCKLET, ViviDockletClass)) + +struct _ViviDocklet { + GtkBin bin; + + char * title; /* title to be used */ + char * icon; /* name of icon for docklet or "gtk-missing-image" */ +}; + +struct _ViviDockletClass +{ + GtkBinClass bin_class; +}; + +GType vivi_docklet_get_type (void); + +void vivi_docklet_set_title (ViviDocklet * docklet, + const char * titlename); +const char * vivi_docklet_get_title (ViviDocklet * docklet); +void vivi_docklet_set_icon (ViviDocklet * docklet, + const char * titlename); +const char * vivi_docklet_get_icon (ViviDocklet * docklet); + + +G_END_DECLS +#endif diff --git a/vivified/dock/vivified-dock.h b/vivified/dock/vivified-dock.h new file mode 100644 index 0000000..401d6c5 --- /dev/null +++ b/vivified/dock/vivified-dock.h @@ -0,0 +1,25 @@ +/* Swfdec + * Copyright (C) 2007 Benjamin Otte <otte at gnome.org> + * + * 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. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA + */ + +#ifndef __VIVIFIED_DOCK_H__ +#define __VIVIFIED_DOCK_H__ + +#include <vivified/dock/vivi_docklet.h> + +#endif diff --git a/vivified/ui/Makefile.am b/vivified/ui/Makefile.am index af6ddbd..05e37df 100644 --- a/vivified/ui/Makefile.am +++ b/vivified/ui/Makefile.am @@ -2,7 +2,8 @@ noinst_PROGRAMS = vivified vivified_CFLAGS = $(GLOBAL_CFLAGS) $(SWFDEC_GTK_CFLAGS) vivified_LDFLAGS = $(SWFDEC_GTK_LIBS) \ - $(top_builddir)/vivified/core/libvivified-core.la + $(top_builddir)/vivified/core/libvivified-core.la \ + $(top_builddir)/vivified/dock/libvivified-dock.la vivified_SOURCES = \ main.c
Possibly Parallel Threads
- 163 commits - autogen.sh configure.ac doc/swfdec-sections.txt libswfdec-gtk/swfdec_gtk_player.c libswfdec-gtk/swfdec_gtk_player.h libswfdec-gtk/swfdec_gtk_widget.c libswfdec-gtk/swfdec_source.c libswfdec/Makefile.am libswfdec/swfdec_as_array.c
- Branch 'vivi' - 15 commits - configure.ac libswfdec/Makefile.am libswfdec/swfdec_as_context.c libswfdec/swfdec_as_debugger.h libswfdec/swfdec_as_object.c libswfdec/swfdec_movie.c libswfdec/swfdec_script.c libswfdec/swfdec_types.h vivified/core vivified/ui
- Branch 'vivi' - 24 commits - configure.ac libswfdec/swfdec_sprite_movie.c libswfdec/swfdec_tag.c libswfdec/swfdec_tag.h vivified/core vivified/dock vivified/ui
- Branch 'vivi' - 23 commits - libswfdec/swfdec_as_object.c libswfdec/swfdec_as_object.h libswfdec/swfdec_as_super.c libswfdec/swfdec_as_with.c libswfdec/swfdec_movie.c libswfdec/swfdec_net_stream.c libswfdec/swfdec_sprite_movie.c test/trace vivified/core
- Branch 'vivi' - 10 commits - libswfdec/swfdec_button_movie.c libswfdec/swfdec_movie.c libswfdec/swfdec_player.c vivified/core vivified/dock vivified/ui