Commit 46e68b35 authored by jacob berkman's avatar jacob berkman Committed by Jacob Berkman

real .server file

2001-10-19  jacob berkman  <jacob@ximian.com>

	* GNOME_Panel.server.in: real .server file

	* panel-shell.[ch]: global corba object - will be used by applets
	to find the panel.  this might not get used - making GNOME_Panel a
	BonoboObject could do the trick as well, but i didn't want to
	touch that yet.

	* main.c (main): create a shell object and register with
	bonobo-activation. if there is already a panel or we couldn't
	register, abort.
parent 69007932
...@@ -8,18 +8,15 @@ panel-marshal.h ...@@ -8,18 +8,15 @@ panel-marshal.h
.libs .libs
Makefile Makefile
Makefile.in Makefile.in
_libs GNOME_Panel.h
gnome-panel.cc
gnome-panel.h
panel panel
panelrc panelrc
appletsConf.sh appletsConf.sh
dockletsConf.sh dockletsConf.sh
gnome-panel-common.c GNOME_Panel-common.c
gnome-panel-stubs.c GNOME_Panel-stubs.c
gnome-panel-skels.c GNOME_Panel-skels.c
gnome-panel-impl.c GNOME_Panel-impl.c
gnome-panel-skelimpl.c
gnome-panel-properties-capplet gnome-panel-properties-capplet
gnome-panel-add-launcher gnome-panel-add-launcher
bad-applet bad-applet
...@@ -33,7 +30,7 @@ gstc.h ...@@ -33,7 +30,7 @@ gstc.h
gwmthumbnail.h gwmthumbnail.h
xgen-gmh xgen-gmh
panel-2 panel-2
panel.server GNOME_Panel.server
panel-typebuiltins.c panel-typebuiltins.c
panel-typebuiltins.h panel-typebuiltins.h
libpanelapplet-2.0.pc libpanelapplet-2.0.pc
2001-10-19 jacob berkman <jacob@ximian.com>
* GNOME_Panel.server.in: real .server file
* panel-shell.[ch]: global corba object - will be used by applets
to find the panel. this might not get used - making GNOME_Panel a
BonoboObject could do the trick as well, but i didn't want to
touch that yet.
* main.c (main): create a shell object and register with
bonobo-activation. if there is already a panel or we couldn't
register, abort.
2001-10-19 Mark McLoughlin <mark@skynet.ie> 2001-10-19 Mark McLoughlin <mark@skynet.ie>
* extern.c, extern.h: * extern.c, extern.h:
......
<oaf_info>
<oaf_server iid="OAFIID:GNOME_PanelShell_Factory" type="exe"
location="panel-2">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/ObjectFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="GNOME Panel Shell factory"/>
<oaf_attribute name="description" type="string" value="GNOME Panel Shell factory"/>
</oaf_server>
<oaf_server iid="OAFIID:GNOME_PanelShell" type="factory"
location="OAFIID:GNOME_PanelShell">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/PanelShell:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="GNOME Panel Shell"/>
<oaf_attribute name="description" type="string" value="GNOME Panel Shell"/>
</oaf_server>
</oaf_info>
<oaf_info>
<oaf_server iid="OAFIID:GNOME_PanelShell_Factory" type="exe"
location="panel-2">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/ObjectFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" _value="GNOME Panel Shell factory"/>
<oaf_attribute name="description" type="string" _value="GNOME Panel Shell factory"/>
</oaf_server>
<oaf_server iid="OAFIID:GNOME_PanelShell" type="factory"
location="OAFIID:GNOME_PanelShell">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/PanelShell:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" _value="GNOME Panel Shell"/>
<oaf_attribute name="description" type="string" _value="GNOME Panel Shell"/>
</oaf_server>
</oaf_info>
...@@ -7,6 +7,12 @@ SUBDIRS = ...@@ -7,6 +7,12 @@ SUBDIRS =
EXTRA_SUBDIRS = config help EXTRA_SUBDIRS = config help
serverdir = $(libdir)/bonobo/servers
server_in_files = GNOME_Panel.server.in
server_DATA = $(server_in_files:.server.in=.server)
@INTLTOOL_SERVER_RULE@
INCLUDES = \ INCLUDES = \
-I. \ -I. \
-I$(srcdir) \ -I$(srcdir) \
...@@ -34,13 +40,13 @@ gwmh_dir = $(top_srcdir)/applets/desk-guide ...@@ -34,13 +40,13 @@ gwmh_dir = $(top_srcdir)/applets/desk-guide
# lib_LTLIBRARIES = libpanel_applet.la libpanel_status.la # lib_LTLIBRARIES = libpanel_applet.la libpanel_status.la
CORBA_SRCLIST = \ CORBA_SRCLIST = \
gnome-panel-stubs.c \ GNOME_Panel-stubs.c \
gnome-panel-skels.c \ GNOME_Panel-skels.c \
gnome-panel-common.c \ GNOME_Panel-common.c \
gnome-panel.h GNOME_Panel.h
$(CORBA_SRCLIST): $(top_srcdir)/idl/gnome-panel.idl $(ORBIT_IDL) $(CORBA_SRCLIST): $(top_srcdir)/idl/GNOME_Panel.idl $(ORBIT_IDL)
$(ORBIT_IDL) -I $(BONOBO_IDLDIR) $(top_srcdir)/idl/gnome-panel.idl $(ORBIT_IDL) -I $(BONOBO_IDLDIR) -I $(BONOBO_ACT_IDLDIR) $(top_srcdir)/idl/GNOME_Panel.idl
panel-marshal.h: panel-marshal.list panel-marshal.h: panel-marshal.list
cd $(srcdir) \ cd $(srcdir) \
...@@ -56,7 +62,7 @@ panel-marshal.c: panel-marshal.h panel-marshal.list ...@@ -56,7 +62,7 @@ panel-marshal.c: panel-marshal.h panel-marshal.list
# We need explicit dependencies here for people building out # We need explicit dependencies here for people building out
# of the tarballs. # of the tarballs.
extern.c: gnome-panel.h extern.c: GNOME_Panel.h
# libpanel_applet_la_SOURCES = \ # libpanel_applet_la_SOURCES = \
# applet-widget.c \ # applet-widget.c \
...@@ -64,7 +70,7 @@ extern.c: gnome-panel.h ...@@ -64,7 +70,7 @@ extern.c: gnome-panel.h
# #
# libpanel_appletinclude_HEADERS = \ # libpanel_appletinclude_HEADERS = \
# applet-widget.h \ # applet-widget.h \
# gnome-panel.h # GNOME_Panel.h
# #
# libpanel_applet_la_LDFLAGS = -version-info 0:1:0 -rpath $(libdir) # libpanel_applet_la_LDFLAGS = -version-info 0:1:0 -rpath $(libdir)
# libpanel_applet_la_LIBADD = $(PANEL_LIBS) -lm # libpanel_applet_la_LIBADD = $(PANEL_LIBS) -lm
...@@ -140,6 +146,7 @@ panel_sources = \ ...@@ -140,6 +146,7 @@ panel_sources = \
menu-properties.c \ menu-properties.c \
launcher.c \ launcher.c \
extern.c \ extern.c \
panel-shell.c \
$(NULL) $(NULL)
panel_headers = \ panel_headers = \
...@@ -201,7 +208,7 @@ panel_2_LDFLAGS=-export-dynamic ...@@ -201,7 +208,7 @@ panel_2_LDFLAGS=-export-dynamic
EXTRA_DIST = \ EXTRA_DIST = \
APPLET_WRITING \ APPLET_WRITING \
panel.server.in \ GNOME_Panel.server.in \
panel.hints \ panel.hints \
gnome-panel-properties.desktop \ gnome-panel-properties.desktop \
nothing.cP \ nothing.cP \
...@@ -210,17 +217,6 @@ EXTRA_DIST = \ ...@@ -210,17 +217,6 @@ EXTRA_DIST = \
gnome-panel-screenshot.glade.h \ gnome-panel-screenshot.glade.h \
libpanelapplet-2.0.pc.in libpanelapplet-2.0.pc.in
SERVER_FILES = \
panel.server
serverdir = $(datadir)/bonobo-activation
server_DATA = $(SERVER_FILES)
panel.server : $(srcdir)/panel.server.in $(top_builddir)/config.status
sed -e "s|\@bindir\@|$(bindir)|" \
$(srcdir)/panel.server.in > panel.server
gladedir = $(datadir)/gnome/panel gladedir = $(datadir)/gnome/panel
glade_DATA =gnome-panel-screenshot.glade glade_DATA =gnome-panel-screenshot.glade
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <applet-widget.h> #include <applet-widget.h>
#include <bonobo-activation/bonobo-activation.h> #include <bonobo-activation/bonobo-activation.h>
#include "gnome-panel.h" #include "GNOME_Panel.h"
struct _AppletWidgetPrivate struct _AppletWidgetPrivate
{ {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <bonobo-activation/bonobo-activation.h> #include <bonobo-activation/bonobo-activation.h>
#include <gnome-panel.h> #include <GNOME_Panel.h>
#define HAVE_SAVE_SESSION_SIGNAL 1 #define HAVE_SAVE_SESSION_SIGNAL 1
#define HAVE_APPLET_BIND_EVENTS 1 #define HAVE_APPLET_BIND_EVENTS 1
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <glib.h> #include <glib.h>
#include "panel.h" #include "panel.h"
#include "panel-widget.h" #include "panel-widget.h"
#include "gnome-panel.h" #include "GNOME_Panel.h"
#include <bonobo-activation/bonobo-activation.h> #include <bonobo-activation/bonobo-activation.h>
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <bonobo-activation/bonobo-activation.h> #include <bonobo-activation/bonobo-activation.h>
#include <libgnomeui/gnome-window-icon.h> #include <libgnomeui/gnome-window-icon.h>
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
#include "gnome-panel.h" #include "GNOME_Panel.h"
static int panel = 0; static int panel = 0;
static int pos = 0; static int pos = 0;
......
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
#include "status.h" #include "status.h"
#include "xstuff.h" #include "xstuff.h"
#include "panel-unique-factory.h"
#include "panel-shell.h"
extern int config_sync_timeout; extern int config_sync_timeout;
extern GSList *panels; extern GSList *panels;
...@@ -471,11 +474,26 @@ tell_user_Im_on_crack (void) ...@@ -471,11 +474,26 @@ tell_user_Im_on_crack (void)
gtk_widget_destroy (dialog); gtk_widget_destroy (dialog);
} }
PanelShell *
panel_get_shell (void)
{
static PanelShell *shell = NULL;
if (!shell) {
shell = g_object_new (PANEL_SHELL_TYPE, NULL);
bonobo_object_set_immortal (BONOBO_OBJECT (shell), TRUE);
}
return shell;
}
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
gboolean duplicate;
gchar *real_global_path; gchar *real_global_path;
PanelShell *shell;
Bonobo_RegistrationResult reg_res;
char *message = NULL;
bindtextdomain (PACKAGE, GNOMELOCALEDIR); bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE); textdomain (PACKAGE);
...@@ -484,66 +502,55 @@ main(int argc, char **argv) ...@@ -484,66 +502,55 @@ main(int argc, char **argv)
LIBGNOMEUI_MODULE, LIBGNOMEUI_MODULE,
argc, argv, NULL); argc, argv, NULL);
tell_user_Im_on_crack (); bonobo_activate ();
gnome_window_icon_set_default_from_file (GNOME_ICONDIR"/gnome-panel.png"); tell_user_Im_on_crack ();
setup_visuals (); shell = panel_get_shell ();
switch (extern_init ()) { reg_res = bonobo_activation_active_server_register (
case EXTERN_SUCCESS: "OAFIID:GNOME_PanelShell",
duplicate = FALSE; BONOBO_OBJREF (shell));
switch (reg_res) {
case Bonobo_ACTIVATION_REG_SUCCESS:
/* whee! success! */
break; break;
case EXTERN_ALREADY_ACTIVE: { case Bonobo_ACTIVATION_REG_ALREADY_ACTIVE:
GtkWidget* box; message = _("I've detected a panel already running,\n"
"and will now exit.");
box = gtk_message_dialog_new ( break;
NULL, 0, default:
GTK_MESSAGE_QUESTION, message = _("There was a problem registering the panel "
GTK_BUTTONS_YES_NO, "with the bonobo-activation server.\n"
(_("I've detected a panel already running.\n" "The panel will now exit.");
"Start another panel as well?\n"
"(The new panel will not be restarted.)")));
if (gtk_dialog_run (GTK_DIALOG (box)) != GTK_RESPONSE_YES) {
gtk_widget_destroy (box);
return -1;
}
gtk_widget_destroy (box);
duplicate = TRUE;
break; break;
} }
case EXTERN_FAILURE: {
GtkWidget *box;
box = panel_error_dialog (
"no_panel_register",
_("There was a problem registering the panel "
"with the GOAD server.\n"
"The panel will now exit."));
if (message) {
GtkWidget *box;
box = gtk_message_dialog_new (NULL,
GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
message);
gtk_dialog_run (GTK_DIALOG (box)); gtk_dialog_run (GTK_DIALOG (box));
gtk_widget_destroy (box); gtk_widget_destroy (box);
return -1; return -1;
break;
}
default:
g_assert_not_reached ();
break;
} }
setup_visuals ();
setup_merge_directory(); setup_merge_directory();
find_kde_directory(); find_kde_directory();
client = gnome_master_client (); client = gnome_master_client ();
gnome_client_set_restart_style (client, duplicate gnome_client_set_restart_style (client, GNOME_RESTART_IMMEDIATELY);
? GNOME_RESTART_NEVER
: GNOME_RESTART_IMMEDIATELY);
gnome_client_set_priority (client, 40); gnome_client_set_priority (client, 40);
......
#include <config.h>
#include "panel-shell.h"
struct _PanelShellPrivate {
int dummy;
};
static GObjectClass *panel_shell_parent_class = NULL;
static void
impl_runBox (PortableServer_Servant servant,
const CORBA_char *initial_string,
CORBA_Environment *ev)
{
PanelShell *shell;
shell = PANEL_SHELL (bonobo_object (servant));
g_message ("run: %s\n", initial_string);
}
static void
panel_shell_finalize (GObject *object)
{
PanelShell *shell = PANEL_SHELL (object);
if (shell->priv) {
g_free (shell->priv);
shell->priv = NULL;
}
panel_shell_parent_class->finalize (object);
}
static void
panel_shell_class_init (PanelShellClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
klass->epv.runBox = impl_runBox;
object_class->finalize = panel_shell_finalize;
panel_shell_parent_class = g_type_class_peek_parent (klass);
}
static void
panel_shell_init (PanelShell *shell)
{
shell->priv = g_new0 (PanelShellPrivate, 1);
}
BONOBO_TYPE_FUNC_FULL (PanelShell,
GNOME_PanelShell,
BONOBO_OBJECT_TYPE,
panel_shell);
#ifndef PANEL_SHELL_H
#define PANEL_SHELL_H
#include "GNOME_Panel.h"
#include <bonobo/bonobo-object.h>
#define PANEL_SHELL_TYPE (panel_shell_get_type ())
#define PANEL_SHELL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PANEL_SHELL_TYPE, PanelShell))
#define PANEL_SHELL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), PANEL_SHELL_TYPE, PanelShellClass))
#define PANEL_IS_SHELL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PANEL_SHELL_TYPE))
#define PANEL_IS_SHELL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PANEL_SHELL_TYPE))
typedef struct _PanelShellPrivate PanelShellPrivate;
typedef struct {
BonoboObject base;
PanelShellPrivate *priv;
} PanelShell;
typedef struct {
BonoboObjectClass parent_class;
POA_GNOME_PanelShell__epv epv;
} PanelShellClass;
GType panel_shell_get_type (void) G_GNUC_CONST;
#endif /* PANEL_SHELL_H */
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#define PANEL_TYPES_H #define PANEL_TYPES_H
#include <gtk/gtktypeutils.h> #include <gtk/gtktypeutils.h>
#include "gnome-panel.h" #include "GNOME_Panel.h"
typedef GNOME_Panel_OrientType PanelOrientType; typedef GNOME_Panel_OrientType PanelOrientType;
#define ORIENT_UP GNOME_Panel_ORIENT_UP #define ORIENT_UP GNOME_Panel_ORIENT_UP
......
<oaf_info>
<oaf_server iid="OAFIID:GNOME_Panel" type="exe" location="@bindir@/panel-2">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/Panel:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="GNOME Panel"/>
</oaf_server>
</oaf_info>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <status-docklet.h> #include <status-docklet.h>
#include <bonobo-activation/bonobo-activation.h> #include <bonobo-activation/bonobo-activation.h>
#include "gnome-panel.h" #include "GNOME_Panel.h"
#define pg_return_if_fail(x) if(!(x)) { g_print("type = %d exid = %s\n", ev._major, ev._repo_id); return; } #define pg_return_if_fail(x) if(!(x)) { g_print("type = %d exid = %s\n", ev._major, ev._repo_id); return; }
#define pg_return_val_if_fail(x,y) if(!(x)) { g_print("type = %d exid = %s\n", ev._major, ev._repo_id); return y;} #define pg_return_val_if_fail(x,y) if(!(x)) { g_print("type = %d exid = %s\n", ev._major, ev._repo_id); return y;}
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <bonobo-activation/bonobo-activation.h> #include <bonobo-activation/bonobo-activation.h>
#include <gnome-panel.h> #include <GNOME_Panel.h>
G_BEGIN_DECLS G_BEGIN_DECLS
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "panel.h" #include "panel.h"
#include "panel-types.h" #include "panel-types.h"
#include "panel-widget.h" #include "panel-widget.h"
#include "gnome-panel.h" #include "GNOME_Panel.h"
#include <bonobo-activation/bonobo-activation.h> #include <bonobo-activation/bonobo-activation.h>
......
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