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

privatise. (extern_set_info, extern_(get|set)_orient, ): kill.

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

        * extern.h, extern.c (extern_ref, extern_unref,
          extern_clean): privatise.
          (extern_set_info, extern_(get|set)_orient, ): kill.
          (extern_handle_*): impl. Privatise the handling of
        this stuff.
          (socket_set_loading): remove ifdef FIXMEs and port
        usage of gdk_pixbuf_new_from_file.

        * applet.c (applet_callback_callback):
          panel.c (freeze_changes, thaw_changes, size_change,
          orientation_change, back_change):
          session.c (send_tooltips_state):
parent 6fc77ba5
2001-10-10 Mark McLoughlin <mark@skynet.ie>
* extern.h, extern.c (extern_ref, extern_unref,
extern_clean): privatise.
(extern_set_info, extern_(get|set)_orient, ): kill.
(extern_handle_*): impl. Privatise the handling of
this stuff.
(socket_set_loading): remove ifdef FIXMEs and port
usage of gdk_pixbuf_new_from_file.
* applet.c (applet_callback_callback):
panel.c (freeze_changes, thaw_changes, size_change,
orientation_change, back_change):
session.c (send_tooltips_state):
2001-10-09 Mark McLoughlin <mark@skynet.ie>
* panel-include.h: remove.
......
......@@ -114,23 +114,9 @@ applet_callback_callback(GtkWidget *widget, gpointer data)
switch(menu->info->type) {
case APPLET_EXTERN:
{
CORBA_Environment env;
GNOME_Applet applet;
g_assert (menu->info->data);
applet = extern_get_applet ((Extern)menu->info->data);
CORBA_exception_init (&env);
GNOME_Applet_do_callback (applet, menu->name, &env);
if (BONOBO_EX (&env))
panel_clean_applet (menu->info);
CORBA_exception_free (&env);
break;
}
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);
......
......@@ -447,13 +447,6 @@ extern_get_applet (Extern ext)
return ext->applet;
}
void
extern_set_info (Extern ext,
AppletInfo *info)
{
ext->info = info;
}
void
extern_set_config_string (Extern ext,
gchar *config_string)
......@@ -464,17 +457,216 @@ extern_set_config_string (Extern ext,
ext->config_string = config_string;
}
PanelOrientation
extern_get_orient (Extern ext)
/*
* FIXME: is this all really needed ?
* I think the whole purpose of the ref/unref is
* to make sure we can set ext->info
*/
static void
extern_remove_applet (Extern ext)
{
return ext->orient;
g_assert (ext->info);
extern_ref (ext);
panel_clean_applet (ext->info);
ext->info = NULL;
extern_unref (ext);
}
void
extern_set_orient (Extern ext,
PanelOrientation orient)
gboolean
extern_handle_back_change (Extern ext,
PanelWidget *panel)
{
GNOME_Panel_BackInfoType backing;
CORBA_Environment env;
GNOME_Applet applet = ext->applet;
g_assert (ext);
if (applet == CORBA_OBJECT_NIL)
return TRUE;
CORBA_exception_init (&env);
backing._d = panel->back_type;
if (panel->back_type == PANEL_BACK_PIXMAP)
backing._u.pmap = panel->back_pixmap;
else if (panel->back_type == PANEL_BACK_COLOR) {
backing._u.c.red = panel->back_color.red;
backing._u.c.green = panel->back_color.green;
backing._u.c.blue = panel->back_color.blue;
}
GNOME_Applet_back_change (applet, &backing, &env);
if (BONOBO_EX (&env)) {
extern_remove_applet (ext);
CORBA_exception_free (&env);
return FALSE;
}
return TRUE;
}
gboolean
extern_handle_freeze_changes (Extern ext)
{
CORBA_Environment env;
GNOME_Applet applet = ext->applet;
g_assert (ext);
if (applet == CORBA_OBJECT_NIL)
return TRUE;
CORBA_exception_init (&env);
GNOME_Applet_freeze_changes (applet, &env);
if (BONOBO_EX (&env)) {
extern_remove_applet (ext);
CORBA_exception_free (&env);
return FALSE;
}
return TRUE;
}
gboolean
extern_handle_thaw_changes (Extern ext)
{
CORBA_Environment env;
GNOME_Applet applet = ext->applet;
g_assert (ext);
if (applet == CORBA_OBJECT_NIL)
return TRUE;
CORBA_exception_init (&env);
GNOME_Applet_thaw_changes (applet, &env);
if (BONOBO_EX (&env)) {
extern_remove_applet (ext);
CORBA_exception_free (&env);
return FALSE;
}
return TRUE;
}
gboolean
extern_handle_change_orient (Extern ext,
int orient)
{
CORBA_Environment env;
GNOME_Applet applet = ext->applet;
g_assert (ext);
if (applet == CORBA_OBJECT_NIL || ext->orient == orient)
return TRUE;
CORBA_exception_init (&env);
GNOME_Applet_change_orient (applet, orient, &env);
if (BONOBO_EX (&env)) {
extern_remove_applet (ext);
CORBA_exception_free (&env);
return FALSE;
}
ext->orient = orient;
return TRUE;
}
gboolean
extern_handle_change_size (Extern ext,
int size)
{
CORBA_Environment env;
GNOME_Applet applet = ext->applet;
g_assert (ext);
if (applet == CORBA_OBJECT_NIL)
return TRUE;
CORBA_exception_init (&env);
GNOME_Applet_change_size (applet, size, &env);
if (BONOBO_EX (&env)) {
extern_remove_applet (ext);
CORBA_exception_free (&env);
return FALSE;
}
return TRUE;
}
gboolean
extern_handle_do_callback (Extern ext,
char *name)
{
CORBA_Environment env;
GNOME_Applet applet = ext->applet;
g_assert (ext);
if (applet == CORBA_OBJECT_NIL)
return TRUE;
CORBA_exception_init (&env);
GNOME_Applet_do_callback (applet, name, &env);
if (BONOBO_EX (&env)) {
extern_remove_applet (ext);
CORBA_exception_free (&env);
return FALSE;
}
return TRUE;
}
gboolean
extern_handle_set_tooltips_state (Extern ext,
gboolean enabled)
{
CORBA_Environment env;
GNOME_Applet applet = ext->applet;
g_assert (ext);
if (applet == CORBA_OBJECT_NIL)
return TRUE;
CORBA_exception_init (&env);
GNOME_Applet_set_tooltips_state (applet, enabled, &env);
if (BONOBO_EX (&env)) {
extern_remove_applet (ext);
CORBA_exception_free (&env);
return FALSE;
}
return TRUE;
}
typedef struct {
......@@ -742,7 +934,6 @@ socket_size_allocate (GtkWidget *applet, GtkAllocation *alloc)
static void
socket_set_loading (GtkWidget *socket, PanelWidget *panel)
{
#ifdef FIXME
static gboolean tried_loading = FALSE;
static GdkPixbuf *pb = NULL;
int size;
......@@ -759,7 +950,7 @@ socket_set_loading (GtkWidget *socket, PanelWidget *panel)
file = gnome_pixmap_file ("gnome-unknown.png");
if (file != NULL) {
pb = gdk_pixbuf_new_from_file (file);
pb = gdk_pixbuf_new_from_file (file, NULL);
g_free (file);
}
......@@ -767,7 +958,7 @@ socket_set_loading (GtkWidget *socket, PanelWidget *panel)
tried_loading = TRUE;
if (pb != NULL) {
GdkPixmap *pm;
GdkPixmap *pm = NULL;
GdkPixbuf *scaled;
if (gdk_pixbuf_get_width (pb) != size ||
......@@ -778,8 +969,6 @@ socket_set_loading (GtkWidget *socket, PanelWidget *panel)
scaled = gdk_pixbuf_ref (pb);
}
pm = NULL;
gdk_pixbuf_render_pixmap_and_mask (scaled, &pm, NULL, 127);
gdk_pixbuf_unref (scaled);
......@@ -790,7 +979,6 @@ socket_set_loading (GtkWidget *socket, PanelWidget *panel)
gdk_pixmap_unref (pm);
}
}
#endif
}
static void
......
......@@ -12,48 +12,54 @@ G_BEGIN_DECLS
typedef struct Extern_struct *Extern;
Extern extern_ref (Extern ext);
void extern_unref (Extern ext);
void extern_clean (Extern ext);
GNOME_Applet extern_get_applet (Extern ext);
GNOME_Applet
extern_get_applet (Extern ext);
void extern_set_config_string (Extern ext,
gchar *config_string);
void extern_set_info (Extern ext,
AppletInfo *info);
void extern_set_config_string
(Extern ext,
gchar *config_string);
gboolean extern_handle_back_change (Extern ext,
PanelWidget *panel);
PanelOrientation
extern_get_orient (Extern ext);
void extern_set_orient (Extern ext,
PanelOrientation orient);
gboolean extern_handle_freeze_changes (Extern ext);
void extern_before_remove (Extern ext);
gboolean extern_handle_thaw_changes (Extern ext);
void load_extern_applet (const char *goad_id,
const char *cfgpath,
PanelWidget *panel,
int pos,
gboolean exactpos,
gboolean queue);
gboolean extern_handle_change_orient (Extern ext,
int orient);
void load_queued_externs (void);
gboolean extern_handle_change_size (Extern ext,
int size);
void panel_corba_clean_up (void);
gboolean extern_handle_do_callback (Extern ext,
char *name);
gint panel_corba_gtk_init (CORBA_ORB panel_orb);
gboolean extern_handle_set_tooltips_state
(Extern ext,
gboolean enabled);
void extern_before_remove (Extern ext);
void load_extern_applet (const char *goad_id,
const char *cfgpath,
PanelWidget *panel,
int pos,
gboolean exactpos,
gboolean queue);
void load_queued_externs (void);
void panel_corba_clean_up (void);
gint panel_corba_gtk_init (CORBA_ORB panel_orb);
/* to be called when we want to send a draw signal to an applet */
void extern_send_draw (Extern ext);
void extern_send_draw (Extern ext);
void save_applet (AppletInfo *info,
gboolean ret);
void save_applet (AppletInfo *info,
gboolean ret);
void extern_save_last_position
(Extern ext,
gboolean sync);
void extern_save_last_position (Extern ext,
gboolean sync);
G_END_DECLS
......
......@@ -129,63 +129,15 @@ panel_realize (GtkWidget *widget, gpointer data)
void
freeze_changes (AppletInfo *info)
{
if (info->type == APPLET_EXTERN) {
GNOME_Applet applet;
Extern ext;
g_assert (info->data);
ext = info->data;
applet = extern_get_applet (ext);
/* ingore this until we get an ior */
if (applet != CORBA_OBJECT_NIL) {
CORBA_Environment env;
CORBA_exception_init (&env);
GNOME_Applet_freeze_changes (applet, &env);
if (BONOBO_EX (&env)) {
extern_ref (ext);
panel_clean_applet (info);
extern_set_info (ext, NULL);
extern_unref (ext);
}
CORBA_exception_free (&env);
}
}
if (info->type == APPLET_EXTERN)
extern_handle_freeze_changes ((Extern)info->data);
}
void
thaw_changes(AppletInfo *info)
{
if (info->type == APPLET_EXTERN) {
GNOME_Applet applet;
Extern ext;
g_assert (info->data);
ext = info->data;
applet = extern_get_applet (ext);
/* ignore this until we get an ior */
if (applet != CORBA_OBJECT_NIL) {
CORBA_Environment env;
CORBA_exception_init (&env);
GNOME_Applet_thaw_changes (applet, &env);
if(BONOBO_EX (&env)) {
extern_ref (ext);
panel_clean_applet (info);
extern_set_info (ext, NULL);
extern_unref (ext);
}
CORBA_exception_free (&env);
}
}
if (info->type == APPLET_EXTERN)
extern_handle_thaw_changes ((Extern)info->data);
}
static void
......@@ -235,60 +187,53 @@ get_applet_orient (PanelWidget *panel)
static void orient_change_foreach(GtkWidget *w, gpointer data);
void
orientation_change(AppletInfo *info, PanelWidget *panel)
orientation_change (AppletInfo *info,
PanelWidget *panel)
{
if (info->type == APPLET_EXTERN) {
GNOME_Applet applet;
Extern ext;
int orient = get_applet_orient (panel);
g_assert (info->data);
ext = info->data;
applet = extern_get_applet (ext);
/* ignore this until we get an ior */
if (applet && (extern_get_orient (ext) != orient)) {
CORBA_Environment env;
CORBA_exception_init (&env);
GNOME_Applet_change_orient (applet, orient, &env);
if (BONOBO_EX(&env)) {
extern_ref (ext);
panel_clean_applet (info);
extern_set_info (ext, NULL);
extern_unref (ext);
}
extern_set_orient (ext, orient);
switch (info->type) {
case APPLET_EXTERN:
extern_handle_change_orient ((Extern)info->data,
get_applet_orient (panel));
break;
case APPLET_MENU:
set_menu_applet_orient ((Menu *)info->data,
get_applet_orient (panel));
break;
case APPLET_DRAWER: {
Drawer *drawer = info->data;
BasePWidget *basep = BASEP_WIDGET (drawer->drawer);
CORBA_exception_free (&env);
set_drawer_applet_orient (drawer,
get_applet_orient (panel));
gtk_widget_queue_resize (drawer->drawer);
gtk_container_foreach (GTK_CONTAINER (basep->panel),
orient_change_foreach,
(gpointer)basep->panel);
}
} else if(info->type == APPLET_MENU) {
Menu *menu = info->data;
set_menu_applet_orient(menu,get_applet_orient(panel));
} else if(info->type == APPLET_DRAWER) {
Drawer *drawer = info->data;
BasePWidget *basep = BASEP_WIDGET(drawer->drawer);
set_drawer_applet_orient(drawer, get_applet_orient(panel));
gtk_widget_queue_resize(drawer->drawer);
gtk_container_foreach(GTK_CONTAINER(basep->panel),
orient_change_foreach,
(gpointer)basep->panel);
} else if(info->type == APPLET_SWALLOW) {
break;
case APPLET_SWALLOW: {
Swallow *swallow = info->data;
if(panel->orient == PANEL_VERTICAL)
set_swallow_applet_orient(swallow,SWALLOW_VERTICAL);
if (panel->orient == PANEL_VERTICAL)
set_swallow_applet_orient (swallow,
SWALLOW_VERTICAL);
else
set_swallow_applet_orient(swallow,SWALLOW_HORIZONTAL);
} else if(info->type == APPLET_STATUS) {
set_swallow_applet_orient (swallow,
SWALLOW_HORIZONTAL);
}
break;
case APPLET_STATUS: {
StatusApplet *status = info->data;
if(status->orient != panel->orient) {
if (status->orient != panel->orient) {
status->orient = panel->orient;
status_applet_update(status);
status_applet_update (status);
}
}
break;
default:
break;
}
}
......@@ -337,32 +282,11 @@ static void size_change_foreach(GtkWidget *w, gpointer data);
void
size_change(AppletInfo *info, PanelWidget *panel)
{
if (info->type == APPLET_EXTERN) {
GNOME_Applet applet;
Extern ext;
g_assert (info->data);
ext = info->data;
applet = extern_get_applet (ext);
if (info->type == APPLET_EXTERN)
extern_handle_change_size ((Extern)info->data,
panel->sz);
/* ignore this until we get an ior */
if (applet != CORBA_OBJECT_NIL) {
CORBA_Environment env;
CORBA_exception_init (&env);
GNOME_Applet_change_size (applet, panel->sz, &env);
if (BONOBO_EX (&env)) {
extern_ref (ext);
panel_clean_applet (info);
extern_set_info (ext, NULL);
extern_unref (ext);
}
CORBA_exception_free (&env);
}
} else if(info->type == APPLET_STATUS) {
else if(info->type == APPLET_STATUS) {
StatusApplet *status = info->data;
status->size = panel->sz;
status_applet_update(status);
......@@ -394,46 +318,10 @@ panel_size_change(GtkWidget *widget,
void
back_change (AppletInfo *info, PanelWidget *panel)
{
if (info->type == APPLET_EXTERN) {
GNOME_Applet applet;
Extern ext;
g_assert (info->data);
ext = info->data;
applet = extern_get_applet (ext);
/* ignore until we have a valid IOR */
if (applet != CORBA_OBJECT_NIL) {
GNOME_Panel_BackInfoType backing;
CORBA_Environment env;
CORBA_exception_init (&env);
backing._d = panel->back_type;
if (panel->back_type == PANEL_BACK_PIXMAP)
backing._u.pmap = panel->back_pixmap;
else if (panel->back_type == PANEL_BACK_COLOR) {
backing._u.c.red = panel->back_color.red;
backing._u.c.green = panel->back_color.green;
backing._u.c.blue = panel->back_color.blue;
}
GNOME_Applet_back_change (applet, &backing, &env);
if (BONOBO_EX (&env)) {
extern_ref (ext);
panel_clean_applet (info);
extern_set_info (ext, NULL);
extern_unref (ext);
}
CORBA_exception_free (&env);
}
}
if (info->type == APPLET_EXTERN)
extern_handle_back_change ((Extern)info->data, panel);
}
static void
back_change_foreach(GtkWidget *w, gpointer data)
{
......
......@@ -93,27 +93,9 @@ send_tooltips_state(gboolean enabled)
for(li = applets; li != NULL; li = li->next) {
AppletInfo *info = li->data;
if (info->type == APPLET_EXTERN) {
GNOME_Applet applet;
Extern ext;
g_assert (info->data);
ext = info->data;
applet = extern_get_applet (ext);
if (applet != CORBA_OBJECT_NIL) {
CORBA_Environment env;
CORBA_exception_init (&env);
GNOME_Applet_set_tooltips_state (applet, enabled, &env);
if(BONOBO_EX (&env))
panel_clean_applet (info);
CORBA_exception_free (&env);
}
}
if (info->type == APPLET_EXTERN)
extern_handle_set_tooltips_state ((Extern)info->data,
enabled);
}
}
......
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