Commit 60039606 authored by Mark McLoughlin's avatar Mark McLoughlin Committed by Mark McLoughlin

kill applet_widget_init.

2001-10-25  Mark McLoughlin  <mark@skynet.ie>

        * applet-widget.c, applet-widget.h: kill applet_widget_init.

        * applet-init.c, applet-init.h: new files - init related stuff
        for libpanel-applet-2.

        * GNOME_Panel_TestApplet.server.in,  test-applet.c:
        simple applet for testing purposes. It doesn't work.

        * Makefile.am: update build.

        * extern.c: cosmetics.
parent 52ca31db
......@@ -31,6 +31,8 @@ gwmthumbnail.h
xgen-gmh
panel-2
GNOME_Panel.server
GNOME_Panel_TestApplet.server
panel-typebuiltins.c
panel-typebuiltins.h
libpanelapplet-2.0.pc
test-applet
2001-10-25 Mark McLoughlin <mark@skynet.ie>
* applet-widget.c, applet-widget.h: kill applet_widget_init.
* applet-init.c, applet-init.h: new files - init related stuff
for libpanel-applet-2.
* GNOME_Panel_TestApplet.server.in, test-applet.c:
simple applet for testing purposes. It doesn't work.
* Makefile.am: update build.
* extern.c: cosmetics.
2001-10-25 Mark McLoughlin <mark@skynet.ie>
* menu.c: (menus_have_icons): use gconf.
......
<oaf_info>
<oaf_server iid="OAFIID:GNOME_TestApplet_Factory"
type="exe"
location="test-applet">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Bonobo/GenericFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="Test Applet Factory"/>
<oaf_attribute name="description" type="string" value="Test Applet Factory"/>
</oaf_server>
<oaf_server iid="OAFIID:GNOME_TestApplet"
type="factory"
location="OAFIID:GNOME_TestApplet_Factory">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/Applet2:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="Test Applet"/>
<oaf_attribute name="description" type="string" value="A simple applet for testing the GNOME-2.0 panel"/>
</oaf_server>
</oaf_info>
......@@ -8,7 +8,7 @@ SUBDIRS =
EXTRA_SUBDIRS = config help
serverdir = $(libdir)/bonobo/servers
server_in_files = GNOME_Panel.server.in
server_in_files = GNOME_Panel.server.in GNOME_Panel_TestApplet.server.in
server_DATA = $(server_in_files:.server.in=.server)
@INTLTOOL_SERVER_RULE@
......@@ -28,59 +28,65 @@ INCLUDES = \
-DGLOBAL_CONFDIR=\""$(sysconfdir)/gnome/panel-config"\" \
-I$(includedir) \
$(PANEL_CFLAGS) \
$(WARN_CFLAGS)
$(WARN_CFLAGS) \
$(NULL)
bin_PROGRAMS = \
panel-2
bin_PROGRAMS = \
panel-2 \
test-applet \
$(NULL)
lib_LTLIBRARIES = \
libpanel-applet-2.la
lib_LTLIBRARIES = \
libpanel-applet-2.la \
$(NULL)
# libpanel-status-2.la
test_applet_SOURCES = \
test-applet.c \
$(NULL)
gwmh_dir = $(top_srcdir)/applets/desk-guide
test_applet_LDADD = \
$(PANEL_LIBS) \
$(top_builddir)/panel/libpanel-applet-2.la \
$(NULL)
libpanel_applet_2_la_SOURCES = \
applet-widget.c \
applet-object.c \
applet-init.c \
applet-private.h \
$(CORBA_SRCLIST) \
$(NULL)
libpanel_applet_2_la_LDFLAGS = -version-info 0:0:0
libpanel_applet_2_la_LIBADD = $(PANEL_LIBS) -lm
CORBA_SRCLIST = \
libpanel_appletincludedir = $(includedir)/gnome-2.0/panel/applet
libpanel_appletinclude_HEADERS =\
applet-widget.h \
applet-object.h \
applet-init.h \
GNOME_Panel.h \
$(NULL)
CORBA_SRCLIST = \
GNOME_Panel-stubs.c \
GNOME_Panel-skels.c \
GNOME_Panel-common.c \
GNOME_Panel.h
GNOME_Panel.h \
$(NULL)
$(CORBA_SRCLIST): $(top_srcdir)/idl/GNOME_Panel.idl $(ORBIT_IDL)
$(ORBIT_IDL) -I $(BONOBO_IDLDIR) -I $(BONOBO_ACT_IDLDIR) $(top_srcdir)/idl/GNOME_Panel.idl
libpanel_applet_2_la_SOURCES = \
applet-widget.c \
applet-object.c \
$(CORBA_SRCLIST)
libpanel_applet_2_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
libpanel_applet_2_la_LIBADD = $(PANEL_LIBS) -lm
gwmh_dir = $(top_srcdir)/applets/desk-guide
libpanel_appletincludedir = $(includedir)/gnome-2.0/panel/applet
libpanel_appletinclude_HEADERS = \
applet-widget.h \
applet-object.h \
GNOME_Panel.h
# libpanel_status_2_la_SOURCES = \
# status-docklet.c \
# $(CORBA_SRCLIST)
#
# libpanel_status_2_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
# libpanel_status_2_la_LIBADD = $(PANEL_LIBS) -lm
#
# libpanel_statusincludedir = $(includedir)
#
# libpanel_statusinclude_HEADERS = \
# status-docklet.h
GWMH_SRCLIST = \
GWMH_SRCLIST = \
gwmh.c \
gwmh.h \
gstc.c \
gstc.h
gstc.h \
$(NULL)
$(GWMH_SRCLIST):
for file in $(GWMH_SRCLIST); do \
......
#include <libgnome/libgnome.h>
#include <libgnomeui/libgnomeui.h>
#include "applet-init.h"
int
applet_factory_main (int argc,
char **argv,
const gchar *iid,
const gchar *name,
const gchar *version,
BonoboFactoryCallback callback,
gpointer data)
{
GnomeProgram *program;
program = gnome_program_init (name, version,
LIBGNOMEUI_MODULE,
argc, argv,
GNOME_PARAM_NONE);
g_object_set (G_OBJECT (program),
GNOME_CLIENT_PARAM_SM_CONNECT,
FALSE, NULL);
return bonobo_generic_factory_main (iid, callback, data);
}
#ifndef __APPLET_INIT_H__
#define __APPLET_INIT_H__
#include <libbonobo.h>
int applet_factory_main (int argc,
char **argv,
const gchar *iid,
const gchar *name,
const gchar *version,
BonoboFactoryCallback callback,
gpointer data);
#define APPLET_BONOBO_FACTORY(iid, name, version, callback, data) \
int main (int argc, char *argv []) \
{ \
return applet_factory_main (argc, argv, iid, name, \
version, callback, data); \
}
#endif /* __APPLET_INIT_H__ */
......@@ -65,7 +65,6 @@ typedef void (*PositionSignal) (GtkObject *object,
static int applet_count = 0;
static gboolean die_on_last = FALSE;
static GtkPlugClass *parent_class;
GType
......@@ -385,7 +384,7 @@ applet_widget_destroy(GtkWidget *w, gpointer data)
applet_count--;
if (die_on_last && !applet_count)
if (!applet_count)
gtk_main_quit();
g_free (applet->priv);
......@@ -786,51 +785,6 @@ applet_widget_get_rgb_background (AppletWidget *applet,
CORBA_free (image);
}
/**
* applet_widget_init:
* @app_id: applet id
* @app_version: applet version
* @argc: the argc passed to main
* @argv: the argv passed to main
* @options: extra popt options to use
* @flags: extra popt flags
* @return_ctx: return popt context
*
* Description: Initialize the applet library, gnome and corba.
* Don't call this if your app has an applet, but your process is not
* simply an applet process. This will 1) disconnect the session
* manager and 2) setup stuff to call gtk_main_quit when the last applet
* you create exists. And that's all really.
*
* Returns: A boolean, %TRUE if we succeed, %FALSE if an error occured
**/
gboolean
applet_widget_init (const char *app_id,
const char *app_version,
int argc,
char **argv,
struct poptOption *options,
unsigned int flags,
poptContext *return_ctx)
{
/*
* this is not called for shlib applets
* so we set it to true here.
*/
die_on_last = TRUE;
gnome_client_disable_master_connection ();
gnome_program_init (app_id, app_version,
LIBGNOMEUI_MODULE,
argc, argv,
GNOME_PARAM_POPT_TABLE,
options, GNOME_PARAM_NONE);
return TRUE;
}
/**
* applet_widget_queue_resize:
* @applet: #AppletWidget to work on
......
......@@ -166,14 +166,6 @@ void applet_widget_get_rgb_background (AppletWidget *applet,
void applet_widget_queue_resize (AppletWidget *applet);
gboolean applet_widget_init (const char *app_id,
const char *app_version,
int argc,
char **argv,
struct poptOption *options,
unsigned int flags,
poptContext *return_ctx);
G_END_DECLS
#endif /* __APPLET_WIDGET_H__ */
......@@ -127,12 +127,11 @@ push_outside_extern (const char *iid,
{
OutsideExtern *oe;
g_return_if_fail (iid);
g_return_if_fail (booter != CORBA_OBJECT_NIL);
g_return_if_fail (iid && booter != CORBA_OBJECT_NIL);
oe = g_new0 (OutsideExtern, 1);
oe->iid = g_strdup (iid);
oe->iid = g_strdup (iid);
oe->booter = CORBA_Object_duplicate (booter, ev);
outside_externs = g_slist_prepend (outside_externs, oe);
......@@ -908,17 +907,6 @@ extern_socket_destroy(GtkWidget *w, gpointer data)
extern_unref (ext);
}
/*static void
sal(GtkWidget *applet, GtkAllocation *alloc)
{
printf("SOCKET req: %dx%d\nSOCKET alloc: %dx%d\n",
applet->requisition.width,
applet->requisition.height,
applet->allocation.width,
applet->allocation.height);
}*/
static void
send_position_change (Extern ext)
{
......@@ -1093,10 +1081,6 @@ reserve_applet_spot (Extern ext, PanelWidget *panel, int pos,
return 0;
}
/* here for debugging purposes */
/*gtk_signal_connect_after(GTK_OBJECT(socket),"size_allocate",
GTK_SIGNAL_FUNC(sal),NULL);*/
gtk_container_add(GTK_CONTAINER(ext->ebox), socket);
gtk_widget_show_all (ext->ebox);
......@@ -1409,9 +1393,8 @@ s_panel_add_applet_full (PortableServer_Servant servant,
info->type = APPLET_EXTERN_RESERVED;
*wid = GDK_WINDOW_XWINDOW (socket->window);
#ifdef PANEL_DEBUG
printf ("\nSOCKET XID: %lX\n\n", (long)*wid);
#endif
dprintf ("\nSOCKET XID: %lX\n\n", (long)*wid);
panelspot_servant = (POA_GNOME_PanelSpot *)ext;
......@@ -1651,16 +1634,14 @@ s_panel_add_launcher_from_info_url (PortableServer_Servant _servant,
}
void
s_panel_run_box (PortableServer_Servant _servant,
const CORBA_char * initial_string,
CORBA_Environment * ev)
s_panel_run_box (PortableServer_Servant servant,
const CORBA_char *initial_string,
CORBA_Environment *ev)
{
#ifdef FIXME
if (string_empty (initial_string))
if (!initial_string || initial_string [0] == '\0')
show_run_dialog ();
else
show_run_dialog_with_text (initial_string);
#endif
}
void
......@@ -1947,10 +1928,8 @@ s_panelspot_register_us(PortableServer_Servant servant,
g_assert (ext != NULL);
g_assert (ext->info != NULL);
#ifdef PANEL_DEBUG
printf("register ext: %lX\n",(long)ext);
printf("register ext->info: %lX\n",(long)(ext->info));
#endif
dprintf("register ext: %lX\n",(long)ext);
dprintf("register ext->info: %lX\n",(long)(ext->info));
panel = PANEL_WIDGET (ext->info->widget->parent);
if (panel == NULL) {
......@@ -2036,10 +2015,8 @@ s_panelspot_show_menu(PortableServer_Servant servant,
GtkWidget *panel;
Extern ext = (Extern)servant;
#ifdef PANEL_DEBUG
printf("show menu ext: %lX\n",(long)ext);
printf("show menu ext->info: %lX\n",(long)(ext->info));
#endif
dprintf("show menu ext: %lX\n",(long)ext);
dprintf("show menu ext->info: %lX\n",(long)(ext->info));
g_assert (ext != NULL);
g_assert (ext->info != NULL);
......@@ -2113,9 +2090,7 @@ s_panelspot_add_callback(PortableServer_Servant servant,
{
Extern ext = (Extern)servant;
#ifdef PANEL_DEBUG
printf("add callback ext: %lX\n",(long)ext);
#endif
g_assert(ext != NULL);
g_assert(ext->info != NULL);
......
#include <string.h>
#include <gtk/gtk.h>
#include <libbonobo.h>
#include "applet-widget.h"
#include "applet-init.h"
static BonoboObject *
test_applet_new (const gchar *iid)
{
GtkWidget *widget;
GtkWidget *label;
widget = applet_widget_new (iid);
label = gtk_label_new ("Hello");
gtk_widget_show (label);
applet_widget_add (APPLET_WIDGET (widget), label);
gtk_widget_show (widget);
return BONOBO_OBJECT (APPLET_WIDGET (widget)->object);
}
static BonoboObject *
test_applet_factory (BonoboGenericFactory *this,
const gchar *iid,
gpointer data)
{
BonoboObject *applet = NULL;
if (!strcmp (iid, "OAFIID:OAFIID:GNOME_Panel_TestApplet"))
applet = test_applet_new (iid);
return applet;
}
APPLET_BONOBO_FACTORY ("OAFIID:GNOME_Panel_TestApplet",
"A Test Applet for the GNOME-2.0 Panel",
"0",
test_applet_factory,
NULL)
<oaf_info>
<oaf_server iid="OAFIID:GNOME_TestApplet_Factory"
type="exe"
location="test-applet">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Bonobo/GenericFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="Test Applet Factory"/>
<oaf_attribute name="description" type="string" value="Test Applet Factory"/>
</oaf_server>
<oaf_server iid="OAFIID:GNOME_TestApplet"
type="factory"
location="OAFIID:GNOME_TestApplet_Factory">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/Applet2:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="Test Applet"/>
<oaf_attribute name="description" type="string" value="A simple applet for testing the GNOME-2.0 panel"/>
</oaf_server>
</oaf_info>
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