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

don't build extern.[ch].

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

        * Makefile.am: don't build extern.[ch].

        * applet.c:
        (applet_idle_remove): handle bonobo applets, remove
        extern stuff.
        (applet_remove_callback): use g_idle_add.
        (applet_callback_callback): fixme for bonobo applets,
        remove extern stuff.

        * applet.h: kill extern stuff.

        * main.c: don't include extern.h. kill panel_in_startup.
        (main): move panel shell registration to panel-shell.h.

        * menu.c:
        (add_test_applet): kill.
        (add_applet): kill.
        (make_add_submenu): kill testing menuitem.

        * panel-applet-frame.[ch]:
        (panel_applet_frame_save_position): impl stub.

        * panel-shell.[ch]:
        (panel_shell_show_error_dialog): impl.
        (panel_shell_register), (panel_shell_unregister): impl.

        * panel.c: kill freeze/thaw changes stuff.
        (orientation_change), (size_change),
        (back_change): kill extern handling.
        (panel_remove_applets): handle bonobo applets.
        (panel_applet_draw): kill.
        (panel_applet_about_to_die): fixme.
        (drag_data_recieved_cb): fixme.
        (panel_widget_setup): don't connect to draw signal.

        * panel_config.c: (config_apply): don't freeze/thaw.

        * session.c:
        (send_tooltips_state): kill.
        (send_applet_session_save): kill.
        (save_applet_configuration): kill extern stuff.
        (panel_session_die): add bonobo applets support.
        (try_evil_config_hacks): kill.
        (init_user_applets): handle bonobo applets.

        * logout.c: don't include extern.h

        * status.c: ditto.

        * swallow.c: ditto.
parent 90a5eada
2001-11-28 Mark McLoughlin <mark@skynet.ie>
* Makefile.am: don't build extern.[ch].
* applet.c:
(applet_idle_remove): handle bonobo applets, remove
extern stuff.
(applet_remove_callback): use g_idle_add.
(applet_callback_callback): fixme for bonobo applets,
remove extern stuff.
* applet.h: kill extern stuff.
* main.c: don't include extern.h. kill panel_in_startup.
(main): move panel shell registration to panel-shell.h.
* menu.c:
(add_test_applet): kill.
(add_applet): kill.
(make_add_submenu): kill testing menuitem.
* panel-applet-frame.[ch]:
(panel_applet_frame_save_position): impl stub.
* panel-shell.[ch]:
(panel_shell_show_error_dialog): impl.
(panel_shell_register), (panel_shell_unregister): impl.
* panel.c: kill freeze/thaw changes stuff.
(orientation_change), (size_change),
(back_change): kill extern handling.
(panel_remove_applets): handle bonobo applets.
(panel_applet_draw): kill.
(panel_applet_about_to_die): fixme.
(drag_data_recieved_cb): fixme.
(panel_widget_setup): don't connect to draw signal.
* panel_config.c: (config_apply): don't freeze/thaw.
* session.c:
(send_tooltips_state): kill.
(send_applet_session_save): kill.
(save_applet_configuration): kill extern stuff.
(panel_session_die): add bonobo applets support.
(try_evil_config_hacks): kill.
(init_user_applets): handle bonobo applets.
* logout.c: don't include extern.h
* status.c: ditto.
* swallow.c: ditto.
2001-11-27 Seth Nickell <snickell@stanford.edu>
* Makefile.am:
......
......@@ -104,7 +104,6 @@ panel_sources = \
swallow.c \
menu-properties.c \
launcher.c \
extern.c \
panel-applet-frame.c \
panel-shell.c \
quick-desktop-reader.c \
......@@ -150,7 +149,6 @@ panel_headers = \
swallow.h \
menu-properties.h \
launcher.h \
extern.h \
panel-applet-frame.h \
quick-desktop-reader.h \
panel-shell.h \
......
......@@ -16,7 +16,6 @@
#include "basep-widget.h"
#include "button-widget.h"
#include "drawer.h"
#include "extern.h"
#include "launcher.h"
#include "menu-properties.h"
#include "menu-util.h"
......@@ -25,6 +24,7 @@
#include "session.h"
#include "status.h"
#include "swallow.h"
#include "panel-applet-frame.h"
#define SMALL_ICON_SIZE 20
......@@ -75,17 +75,22 @@ panel_applet_clean (AppletInfo *info)
}
static gboolean
kill_applet_in_idle(gpointer data)
applet_idle_remove (gpointer data)
{
AppletInfo *info = data;
if (info->type == APPLET_EXTERN)
extern_save_last_position ((Extern)info->data, TRUE);
else if (info->type == APPLET_SWALLOW) {
switch (info->type) {
case APPLET_BONOBO:
panel_applet_frame_save_position (PANEL_APPLET_FRAME (info->data));
break;
case APPLET_SWALLOW: {
Swallow *swallow = info->data;
swallow->clean_remove = TRUE;
}
break;
default:
break;
}
panel_applet_clean (info);
......@@ -94,9 +99,10 @@ kill_applet_in_idle(gpointer data)
}
static void
remove_applet_callback(GtkWidget *widget, AppletInfo *info)
applet_remove_callback (GtkWidget *widget,
AppletInfo *info)
{
gtk_idle_add (kill_applet_in_idle, info);
g_idle_add (applet_idle_remove, info);
}
static void
......@@ -107,10 +113,6 @@ applet_callback_callback(GtkWidget *widget, gpointer data)
g_return_if_fail(menu->info != NULL);
switch(menu->info->type) {
case APPLET_EXTERN:
extern_handle_do_callback ((Extern)menu->info->data,
menu->name);
break;
case APPLET_LAUNCHER:
if (strcmp (menu->name, "properties") == 0) {
launcher_properties (menu->info->data);
......@@ -211,7 +213,14 @@ applet_callback_callback(GtkWidget *widget, gpointer data)
if (strcmp (menu->name, "help") == 0)
panel_show_help ("specialobjects", "RUNBUTTON");
break;
default: break;
case APPLET_BONOBO:
/*
* Applet's menu's are handled differently
*/
break;
default:
g_assert_not_reached ();
break;
}
}
......@@ -513,9 +522,9 @@ panel_applet_create_menu (AppletInfo *info,
setup_menuitem (menuitem, image , _("Remove from panel"));
g_signal_connect (G_OBJECT (menuitem),
"activate",
G_CALLBACK (remove_applet_callback),
info);
"activate",
G_CALLBACK (applet_remove_callback),
info);
gtk_menu_shell_append (GTK_MENU_SHELL (info->menu), menuitem);
......@@ -527,9 +536,9 @@ panel_applet_create_menu (AppletInfo *info,
setup_menuitem (menuitem, NULL, _("Move"));
g_signal_connect (G_OBJECT (menuitem),
"activate",
G_CALLBACK (move_applet_callback),
info);
"activate",
G_CALLBACK (move_applet_callback),
info);
gtk_menu_shell_append (GTK_MENU_SHELL (info->menu), menuitem);
}
......
......@@ -12,16 +12,13 @@ G_BEGIN_DECLS
#define DRAWER_ID "Drawer"
#define LOGOUT_ID "Logout"
#define SWALLOW_ID "Swallow"
#define EXTERN_ID "Extern"
#define LAUNCHER_ID "Launcher"
#define LOCK_ID "Lock"
#define STATUS_ID "Status"
#define RUN_ID "Run"
#define BONOBO_ID "Bonobo"
typedef enum {
APPLET_EXTERN,
APPLET_EXTERN_RESERVED,
APPLET_EXTERN_PENDING,
APPLET_DRAWER,
APPLET_MENU,
APPLET_LOGOUT,
......
......@@ -14,7 +14,6 @@
#include "menu.h"
#include "panel_config_global.h"
#include "panel.h"
#include "extern.h"
#include "session.h"
extern GtkTooltips *panel_tooltips;
......
......@@ -22,7 +22,6 @@
#include "conditional.h"
#include "drawer-widget.h"
#include "extern.h"
#include "menu-fentry.h"
#include "menu.h"
#include "multiscreen-stuff.h"
......@@ -57,8 +56,6 @@ char *kde_menudir = NULL;
char *kde_icondir = NULL;
char *kde_mini_icondir = NULL;
gboolean panel_in_startup = TRUE;
static gboolean
menu_age_timeout(gpointer data)
{
......@@ -434,26 +431,10 @@ tell_user_Im_on_crack (void)
gtk_widget_destroy (dialog);
}
static 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
main(int argc, char **argv)
{
gchar *real_global_path;
PanelShell *shell;
Bonobo_RegistrationResult reg_res;
char *message = NULL;
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
......@@ -474,58 +455,8 @@ main(int argc, char **argv)
*/
putenv ("BONOBO_ACTIVATION_DEBUG_OUTPUT=1");
switch (extern_init ()) {
case EXTERN_SUCCESS:
break;
case EXTERN_ALREADY_ACTIVE:
message = _("I've detected a panel already running,\n"
"and will now exit.");
break;
case EXTERN_FAILURE: {
message = _("There was a problem registering the panel "
"with the bonobo-activation server.\n"
"The panel will now exit.");
break;
}
default:
g_assert_not_reached ();
break;
}
shell = panel_get_shell ();
reg_res = bonobo_activation_active_server_register (
"OAFIID:GNOME_PanelShell",
BONOBO_OBJREF (shell));
switch (reg_res) {
case Bonobo_ACTIVATION_REG_SUCCESS:
/* whee! success! */
break;
case Bonobo_ACTIVATION_REG_ALREADY_ACTIVE:
message = _("I've detected a panel already running,\n"
"and will now exit.");
break;
default:
message = _("There was a problem registering the panel "
"with the bonobo-activation server.\n"
"The panel will now exit.");
break;
}
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_widget_destroy (box);
if (!panel_shell_register ())
return -1;
}
setup_visuals ();
......@@ -604,12 +535,6 @@ main(int argc, char **argv)
/* add some timeouts */
gtk_timeout_add (10*1000, menu_age_timeout, NULL);
panel_in_startup = FALSE;
/*load these as the last thing to prevent some races any races from
starting multiple goad_id's at once are libgnorba's problem*/
extern_load_queued ();
status_applet_create_offscreen ();
gtk_main ();
......
......@@ -41,7 +41,6 @@
#include "distribution.h"
#include "drawer-widget.h"
#include "edge-widget.h"
#include "extern.h"
#include "floating-widget.h"
#include "foobar-widget.h"
#include "gnome-run.h"
......@@ -2271,51 +2270,12 @@ try_add_status_to_panel (GtkWidget *widget, gpointer data)
}
}
/*
* FIXME: only a temporary testing menuitem
*/
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, panel, -1, FALSE, FALSE);
}
static void
add_applet (GtkWidget *w, const char *item_loc)
{
g_warning ("FIXME: add_applet() not implemented\n");
#ifdef FIXME
GnomeDesktopEntry *ii;
char *goad_id;
ii = gnome_desktop_entry_load(item_loc);
if (ii == NULL) {
panel_error_dialog ("cannot_load_entry",
_("Can't load entry"));
return;
}
goad_id = get_applet_goad_id_from_dentry(ii);
gnome_desktop_entry_free(ii);
if(!goad_id) {
panel_error_dialog("cannot_get_goad_id_from_entry",
_("Can't get goad_id from desktop entry!"));
return;
}
extern_load_applet (goad_id, NULL,
get_panel_from_menu_data (w, TRUE),
-1, FALSE, FALSE);
g_free (goad_id);
#endif
/*
* FIXME: remove all old applet's menu code
*/
}
static void
......@@ -4401,15 +4361,6 @@ make_add_submenu (GtkWidget *menu, gboolean fake_submenus)
g_signal_connect (G_OBJECT(menuitem), "activate",
G_CALLBACK(try_add_status_to_panel),NULL);
setup_internal_applet_drag(menuitem, "STATUS:TRY");
/*
* FIXME: only a temporary testing menuitem
*/
menuitem = gtk_menu_item_new ();
setup_menuitem (menuitem, 0, _("Test Applet"));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
g_signal_connect (G_OBJECT (menuitem), "activate",
G_CALLBACK (add_test_applet), NULL);
}
static void
......
......@@ -95,6 +95,14 @@ panel_applet_frame_load (const gchar *iid,
panel_applet_frame_set_info (PANEL_APPLET_FRAME (frame), info);
}
void
panel_applet_frame_save_position (PanelAppletFrame *frame)
{
/*
* FIXME: implement.
*/
}
void
panel_applet_frame_change_orient (PanelAppletFrame *frame,
PanelOrient orient)
......
......@@ -68,6 +68,8 @@ void panel_applet_frame_change_background_color (PanelAppletFrame *frame,
void panel_applet_frame_clear_background (PanelAppletFrame *frame);
void panel_applet_frame_save_position (PanelAppletFrame *frame);
G_END_DECLS
......
......@@ -521,8 +521,6 @@ config_apply (PerPanelConfig *ppc)
/* don't update selves, all changes coming from ME */
ppc->ppc_origin_change = TRUE;
panel_freeze_changes (PANEL_WIDGET (BASEP_WIDGET (ppc->panel)->panel));
if(EDGE_IS_WIDGET(ppc->panel))
border_widget_change_params(BORDER_WIDGET(ppc->panel),
ppc->screen,
......@@ -615,8 +613,6 @@ config_apply (PerPanelConfig *ppc)
&ppc->back_color);
}
panel_thaw_changes (PANEL_WIDGET (BASEP_WIDGET (ppc->panel)->panel));
/* start registering changes again */
ppc->ppc_origin_change = FALSE;
......
#include <config.h>
#include <libgnome/gnome-i18n.h>
#include <gtk/gtk.h>
#include "panel-shell.h"
......@@ -8,6 +11,69 @@ struct _PanelShellPrivate {
static GObjectClass *panel_shell_parent_class = NULL;
/*
* PanelShell is a singleton.
*/
static PanelShell *panel_shell = NULL;
static void
panel_shell_show_error_dialog (const gchar *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_widget_destroy (box);
}
gboolean
panel_shell_register (void)
{
if (!panel_shell) {
Bonobo_RegistrationResult reg_res;
gchar *message = NULL;
panel_shell = g_object_new (PANEL_SHELL_TYPE, NULL);
bonobo_object_set_immortal (BONOBO_OBJECT (panel_shell), TRUE);
reg_res = bonobo_activation_active_server_register (
"OAFIID:GNOME_PanelShell",
BONOBO_OBJREF (panel_shell));
switch (reg_res) {
case Bonobo_ACTIVATION_REG_SUCCESS:
break;
case Bonobo_ACTIVATION_REG_ALREADY_ACTIVE:
message = _("I've detected a panel already running,\n"
"and will now exit.");
break;
default:
message = _("There was a problem registering the panel "
"with the bonobo-activation server.\n"
"The panel will now exit.");
break;
}
if (message) {
panel_shell_show_error_dialog (message);
return FALSE;
}
}
return TRUE;
}
void
panel_shell_unregister (void)
{
bonobo_activation_active_server_unregister ("OAFIID:GNOME_PanelShell",
BONOBO_OBJREF (panel_shell));
}
static void
impl_displayRunDialog (PortableServer_Servant servant,
const CORBA_char *initial_string,
......
......@@ -25,6 +25,9 @@ typedef struct {
POA_GNOME_PanelShell__epv epv;
} PanelShellClass;
GType panel_shell_get_type (void) G_GNUC_CONST;
GType panel_shell_get_type (void) G_GNUC_CONST;
gboolean panel_shell_register (void);
void panel_shell_unregister (void);
#endif /* PANEL_SHELL_H */
......@@ -25,7 +25,6 @@
#include "distribution.h"
#include "drawer-widget.h"
#include "edge-widget.h"
#include "extern.h"
#include "floating-widget.h"
#include "foobar-widget.h"
#include "gnome-run.h"
......@@ -108,48 +107,6 @@ panel_realize (GtkWidget *widget, gpointer data)
gtk_widget_queue_resize (GTK_WIDGET (widget));
}
void
freeze_changes (AppletInfo *info)
{
if (info->type == APPLET_EXTERN)
extern_handle_freeze_changes ((Extern)info->data);
}
void
thaw_changes(AppletInfo *info)
{
if (info->type == APPLET_EXTERN)
extern_handle_thaw_changes ((Extern)info->data);
}
static void
freeze_changes_foreach(GtkWidget *w, gpointer data)
{
AppletInfo *info = gtk_object_get_data(GTK_OBJECT(w), "applet_info");
freeze_changes(info);
}
void
panel_freeze_changes(PanelWidget *panel)
{
gtk_container_foreach(GTK_CONTAINER(panel),
freeze_changes_foreach, NULL);
}
static void
thaw_changes_foreach(GtkWidget *w, gpointer data)
{
AppletInfo *info = gtk_object_get_data(GTK_OBJECT(w), "applet_info");
thaw_changes(info);
}
void
panel_thaw_changes(PanelWidget *panel)
{
gtk_container_foreach(GTK_CONTAINER(panel),
thaw_changes_foreach, NULL);
}
PanelOrient
get_applet_orient (PanelWidget *panel)
{
......@@ -174,10 +131,6 @@ orientation_change (AppletInfo *info,
{
switch (info->type) {
case APPLET_EXTERN:
extern_handle_change_orient ((Extern)info->data,
get_applet_orient (panel));
break;
case APPLET_BONOBO:
panel_applet_frame_change_orient ((PanelAppletFrame *) info->data,
get_applet_orient (panel));
......@@ -276,9 +229,6 @@ size_change (AppletInfo *info,
panel_applet_frame_change_size (
PANEL_APPLET_FRAME (info->data), size);
break;
case APPLET_EXTERN:
extern_handle_change_size ((Extern)info->data, size);
break;
case APPLET_STATUS: {
StatusApplet *status = info->data;
......@@ -315,14 +265,10 @@ panel_size_change(GtkWidget *widget,
}
void
back_change (AppletInfo *info,
back_change (AppletInfo *info,
PanelWidget *panel)
{
switch (info->type) {
case APPLET_EXTERN:
extern_handle_back_change ((Extern)info->data, panel);
break;
case APPLET_BONOBO: {
if (info->type == APPLET_BONOBO) {
PanelAppletFrame *frame = PANEL_APPLET_FRAME (info->data);
switch (panel->back_type) {
......@@ -343,11 +289,6 @@ back_change (AppletInfo *info,
g_assert_not_reached ();
break;
}
}
break;
default:
break;
}
}
......@@ -497,11 +438,9 @@ panel_applet_added(GtkWidget *widget, GtkWidget *applet, gpointer data)
basep_widget_queue_autohide(BASEP_WIDGET(panelw));
}
freeze_changes(info);
orientation_change(info,PANEL_WIDGET(widget));
size_change(info,PANEL_WIDGET(widget));
back_change(info,PANEL_WIDGET(widget));
thaw_changes(info);
/*we will need to save this applet's config now*/
applets_to_sync = TRUE;
......@@ -562,23 +501,30 @@ panel_move_timeout(gpointer data)
}
static void
clean_kill_applets (PanelWidget *panel)
panel_remove_applets (PanelWidget *panel)
{
GList *li;
GList *l;
for (li = panel->applet_list; li != NULL; li = li->next) {
AppletData *ad = li->data;
AppletInfo *info =
gtk_object_get_data (GTK_OBJECT (ad->applet),
"applet_info");
for (l = panel->applet_list; l; l = l->next) {
AppletData *ad = l->data;
AppletInfo *info;
if (info->type == APPLET_EXTERN)
extern_save_last_position ((Extern)info->data, FALSE);
info = gtk_object_get_data (GTK_OBJECT (ad->applet),
"applet_info");
else if (info->type == APPLET_SWALLOW) {
switch (info->type) {
case APPLET_BONOBO:
panel_applet_frame_save_position (
PANEL_APPLET_FRAME (info->data));
break;
case APPLET_SWALLOW: {
Swallow *swallow = info->data;
swallow->clean_remove = TRUE;
}
break;
default:
break;
}
}
......@@ -596,7 +542,7 @@ panel_destroy (GtkWidget *widget, gpointer data)
else if (FOOBAR_IS_WIDGET (widget))
panel = PANEL_WIDGET (FOOBAR_WIDGET (widget)->panel);
clean_kill_applets (panel);
panel_remove_applets (panel);
kill_config_dialog(widget);
......@@ -637,30 +583,23 @@ panel_applet_move(PanelWidget *panel, GtkWidget *widget, gpointer data)
}
static void
panel_applet_draw(GtkWidget *panel, GtkWidget *widget, gpointer data)
panel_applet_about_to_die (GtkWidget *panel,
GtkWidget *widget,
gpointer data)
{
AppletInfo *info = gtk_object_get_data(GTK_OBJECT(widget),
"applet_info");
g_return_if_fail(info!=NULL);
if(info->type == APPLET_EXTERN)
extern_send_draw(info->data);
}
AppletInfo *info;
static void
panel_applet_about_to_die (GtkWidget *panel, GtkWidget *widget, gpointer data)
{
AppletInfo *info = gtk_object_get_data (GTK_OBJECT (widget),
"applet_info");
info = gtk_object_get_data (GTK_OBJECT (widget),
"applet_info");
g_return_if_fail (info != NULL);
g_return_if_fail (info);
/* this needs to be befor we null the widget field */
if (info->type == APPLET_EXTERN &&
info->data != NULL) {
extern_before_remove (info->data);
}
/*
* FIXME
*/
if (info->type == APPLET_BONOBO)
g_warning (G_STRLOC " FIXME: we need to implement an "
"applet died dialog box\n");
}
static GtkWidget *
......@@ -1489,10 +1428,9 @@ drag_data_recieved_cb (GtkWidget *widget,
gtk_drag_finish (context, FALSE, FALSE, time);
return;
}
#ifdef FIXME
extern_load_applet ((char *)selection_data->data,
NULL, panel, pos, TRUE, FALSE);
#endif
/*
* FIXME: sort out applet's drag and drop
*/
break;
case TARGET_APPLET_INTERNAL:
drop_internal_applet (panel, pos, (char *)selection_data->data,
......@@ -1525,10 +1463,6 @@ panel_widget_setup(PanelWidget *panel)
"applet_move",
G_CALLBACK(panel_applet_move),
NULL);
g_signal_connect (G_OBJECT(panel),
"applet_draw",