Commit 79fcbf9c authored by Mark McLoughlin's avatar Mark McLoughlin Committed by Mark McLoughlin

A first stab at BonoboControl based applets. It works suprisingly well for

2001-11-01  Mark McLoughlin  <mark@skynet.ie>

        A first stab at BonoboControl based applets. It works
        suprisingly well for 84 lines of code :)

        * panel-applet-frame.c, panel-applet-frame.h: new files.
        BonoboControl based applet support.

        * applet.h: add new AppletType - APPLET_BONOBO.

        * menu.c: (add_test_bonobo_applet): impl.
        (make_add_submenu): add new menuitem to activate a
        test bonobo applet.

        * test-bonobo-applet.c: BonoboControl based test applet.

        * GNOME_Panel_TestApplet.server.in: add TestBonoboApplet.

        * Makefile.am: upd.
parent 9d98bdc9
2001-11-01 Mark McLoughlin <mark@skynet.ie>
A first stab at BonoboControl based applets. It works
suprisingly well for 84 lines of code :)
* panel-applet-frame.c, panel-applet-frame.h: new files.
BonoboControl based applet support.
* applet.h: add new AppletType - APPLET_BONOBO.
* menu.c: (add_test_bonobo_applet): impl.
(make_add_submenu): add new menuitem to activate a
test bonobo applet.
* test-bonobo-applet.c: BonoboControl based test applet.
* GNOME_Panel_TestApplet.server.in: add TestBonoboApplet.
* Makefile.am: upd.
2001-11-01 Mark McLoughlin <mark@skynet.ie>
* applet-object.c: (applet_object_panel_quit), (applet_object_new):
......
<oaf_info>
<!--
Old Type Applet.
-->
<oaf_server iid="OAFIID:GNOME_Panel_TestApplet_Factory"
type="exe"
location="test-applet">
......@@ -26,4 +30,34 @@
</oaf_server>
<!--
New Type Applet.
-->
<oaf_server iid="OAFIID:GNOME_Panel_TestBonoboApplet_Factory"
type="exe"
location="test-bonobo-applet">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Bonobo/GenericFactory:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="Test Bonobo Applet Factory"/>
<oaf_attribute name="description" type="string" value="Test Bonobo Applet Factory"/>
</oaf_server>
<oaf_server iid="OAFIID:GNOME_Panel_TestBonoboApplet"
type="factory"
location="OAFIID:GNOME_Panel_TestBonoboApplet_Factory">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Bonobo/Control:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="Test Bonobo Applet"/>
<oaf_attribute name="description" type="string" value="A simple applet for testing the GNOME-2.0 panel"/>
</oaf_server>
</oaf_info>
......@@ -34,6 +34,7 @@ INCLUDES = \
bin_PROGRAMS = \
panel-2 \
test-applet \
test-bonobo-applet \
$(NULL)
lib_LTLIBRARIES = \
......@@ -49,6 +50,14 @@ test_applet_LDADD = \
$(top_builddir)/panel/libpanel-applet-2.la \
$(NULL)
test_bonobo_applet_SOURCES = \
test-bonobo-applet.c \
$(NULL)
test_bonobo_applet_LDADD = \
$(PANEL_LIBS) \
$(NULL)
libpanel_applet_2_la_SOURCES = \
applet-widget.c \
applet-object.c \
......@@ -143,6 +152,7 @@ panel_sources = \
menu-properties.c \
launcher.c \
extern.c \
panel-applet-frame.c \
panel-shell.c \
$(NULL)
......@@ -187,6 +197,7 @@ panel_headers = \
menu-properties.h \
launcher.h \
extern.h \
panel-applet-frame.h \
$(NULL)
panel_2_SOURCES = \
......
......@@ -3,6 +3,8 @@
#include <libbonobo.h>
G_BEGIN_DECLS
int applet_factory_main (int argc,
char **argv,
const gchar *iid,
......@@ -18,4 +20,6 @@ int main (int argc, char *argv [])
version, callback, data); \
}
G_END_DECLS
#endif /* __APPLET_INIT_H__ */
......@@ -30,7 +30,8 @@ typedef enum {
APPLET_EMPTY,
APPLET_LOCK,
APPLET_STATUS,
APPLET_RUN
APPLET_RUN,
APPLET_BONOBO
} AppletType;
#define APPLET_EVENT_MASK (GDK_BUTTON_PRESS_MASK | \
......
......@@ -56,6 +56,7 @@
#include "tasklist_icon.h"
#include "tearoffitem.h"
#include "title-item.h"
#include "panel-applet-frame.h"
/*#define PANEL_DEBUG 1*/
......@@ -2279,10 +2280,26 @@ static void
add_test_applet (GtkWidget *widget,
gpointer dummy)
{
PanelWidget *panel;
panel = get_panel_from_menu_data (widget, TRUE);
extern_load_applet ("OAFIID:GNOME_Panel_TestApplet",
NULL,
get_panel_from_menu_data (widget, TRUE),
-1, FALSE, FALSE);
NULL, panel, -1, FALSE, FALSE);
}
/*
* FIXME: only a temporary testing menuitem
*/
static void
add_test_bonobo_applet (GtkWidget *widget,
gpointer dummy)
{
PanelWidget *panel;
panel = get_panel_from_menu_data (widget, TRUE);
panel_applet_load ("OAFIID:GNOME_Panel_TestBonoboApplet", panel, -1);
}
static void
......@@ -5013,6 +5030,17 @@ make_add_submenu (GtkWidget *menu, gboolean fake_submenus)
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
GTK_SIGNAL_FUNC (add_test_applet), NULL);
/*
* FIXME: only a temporary testing menuitem
*/
menuitem = gtk_menu_item_new ();
gtk_widget_lock_accelerators (menuitem);
setup_menuitem (menuitem, 0, _("Test Bonobo Applet"));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
GTK_SIGNAL_FUNC (add_test_bonobo_applet), NULL);
}
static void
......
#include <libbonoboui.h>
#include "panel-applet-frame.h"
#include "applet.h"
void
panel_applet_load (const gchar *iid,
PanelWidget *panel,
gint pos)
{
GtkWidget *control;
gboolean success;
control = bonobo_widget_new_control (iid, NULL);
success = register_toy (control,
NULL, /* FIXME: data */
NULL, /* FIXME: data_destroy */
panel,
pos,
FALSE,
APPLET_BONOBO);
if (!success)
g_warning ("Cannot register control widget\n");
}
#ifndef __PANEL_APPLET_CONTROL_H__
#define __PANEL_APPLET_CONTROL_H__
#include "panel-widget.h"
G_BEGIN_DECLS
void panel_applet_load (const gchar *iid,
PanelWidget *panel,
gint pos);
G_END_DECLS
#endif /* __PANEL_APPLET_CONTROL_H__ */
#include <config.h>
#include <string.h>
#include <libbonoboui.h>
static BonoboObject *
test_applet_new (const gchar *iid)
{
BonoboControl *control;
GtkWidget *label;
g_message ("test_applet_new: %s\n", iid);
label = gtk_label_new ("Hello");
gtk_widget_show (label);
control = bonobo_control_new (label);
return BONOBO_OBJECT (control);
}
static BonoboObject *
test_applet_factory (BonoboGenericFactory *this,
const gchar *iid,
gpointer data)
{
BonoboObject *applet = NULL;
g_message ("test_applet_factory: %s\n", iid);
if (!strcmp (iid, "OAFIID:GNOME_Panel_TestBonoboApplet"))
applet = test_applet_new (iid);
g_message ("test_applet_factory: returning %p\n", applet);
return applet;
}
BONOBO_ACTIVATION_FACTORY ("OAFIID:GNOME_Panel_TestBonoboApplet_Factory",
"A Test Applet for the GNOME-2.0 Panel",
"0",
test_applet_factory,
NULL)
<oaf_info>
<!--
Old Type Applet.
-->
<oaf_server iid="OAFIID:GNOME_Panel_TestApplet_Factory"
type="exe"
location="test-applet">
......@@ -26,4 +30,34 @@
</oaf_server>
<!--
New Type Applet.
-->
<oaf_server iid="OAFIID:GNOME_Panel_TestBonoboApplet_Factory"
type="exe"
location="test-bonobo-applet">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Bonobo/GenericFactory:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="Test Bonobo Applet Factory"/>
<oaf_attribute name="description" type="string" value="Test Bonobo Applet Factory"/>
</oaf_server>
<oaf_server iid="OAFIID:GNOME_Panel_TestBonoboApplet"
type="factory"
location="OAFIID:GNOME_Panel_TestBonoboApplet_Factory">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Bonobo/Control:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="Test Bonobo Applet"/>
<oaf_attribute name="description" type="string" value="A simple applet for testing the GNOME-2.0 panel"/>
</oaf_server>
</oaf_info>
#include <config.h>
#include <string.h>
#include <libbonoboui.h>
static BonoboObject *
test_applet_new (const gchar *iid)
{
BonoboControl *control;
GtkWidget *label;
g_message ("test_applet_new: %s\n", iid);
label = gtk_label_new ("Hello");
gtk_widget_show (label);
control = bonobo_control_new (label);
return BONOBO_OBJECT (control);
}
static BonoboObject *
test_applet_factory (BonoboGenericFactory *this,
const gchar *iid,
gpointer data)
{
BonoboObject *applet = NULL;
g_message ("test_applet_factory: %s\n", iid);
if (!strcmp (iid, "OAFIID:GNOME_Panel_TestBonoboApplet"))
applet = test_applet_new (iid);
g_message ("test_applet_factory: returning %p\n", applet);
return applet;
}
BONOBO_ACTIVATION_FACTORY ("OAFIID:GNOME_Panel_TestBonoboApplet_Factory",
"A Test Applet for the GNOME-2.0 Panel",
"0",
test_applet_factory,
NULL)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment