1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3
* panel-applet-frame.c: panel side container for applets
5
* Copyright (C) 2010 Carlos Garcia Campos <carlosgc@gnome.org>
6
* Copyright (C) 2001 - 2003 Sun Microsystems, Inc.
8
* This program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public License as
10
* published by the Free Software Foundation; either version 2 of the
11
* License, or (at your option) any later version.
13
* This program is distributed in the hope that it will be useful, but
14
* WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
* General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program; if not, write to the Free Software
20
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24
* Mark McLoughlin <mark@skynet.ie>
30
#include <glib/gi18n.h>
32
#include <gconf/gconf.h>
36
#include "panel-applets-manager.h"
37
#include "panel-profile.h"
40
#include "panel-marshal.h"
41
#include "panel-background.h"
42
#include "panel-lockdown.h"
43
#include "panel-stock-icons.h"
45
#include "panel-compatibility.h"
47
#include "panel-applet-frame.h"
49
static void panel_applet_frame_activating_free (PanelAppletFrameActivating *frame_act);
51
static void panel_applet_frame_loading_failed (const char *iid,
55
static void panel_applet_frame_load (const gchar *iid,
62
struct _PanelAppletFrameActivating {
70
/* PanelAppletFrame implementation */
72
G_DEFINE_TYPE (PanelAppletFrame, panel_applet_frame, GTK_TYPE_EVENT_BOX)
74
#define PANEL_APPLET_FRAME_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PANEL_TYPE_APPLET_FRAME, PanelAppletFramePrivate))
76
#define HANDLE_SIZE 10
77
#define PANEL_APPLET_PREFS_KEY "/apps/panel/applets/%s/prefs"
79
struct _PanelAppletFramePrivate {
81
AppletInfo *applet_info;
83
PanelOrientation orientation;
87
GtkAllocation child_allocation;
88
GdkRectangle handle_rect;
94
panel_applet_frame_paint (GtkWidget *widget,
97
PanelAppletFrame *frame;
99
frame = PANEL_APPLET_FRAME (widget);
101
if (!frame->priv->has_handle)
104
if (gtk_widget_is_drawable (widget)) {
105
GtkOrientation orientation = GTK_ORIENTATION_HORIZONTAL;
107
switch (frame->priv->orientation) {
108
case PANEL_ORIENTATION_TOP:
109
case PANEL_ORIENTATION_BOTTOM:
110
orientation = GTK_ORIENTATION_VERTICAL;
112
case PANEL_ORIENTATION_LEFT:
113
case PANEL_ORIENTATION_RIGHT:
114
orientation = GTK_ORIENTATION_HORIZONTAL;
117
g_assert_not_reached ();
122
gtk_widget_get_style (widget), gtk_widget_get_window (widget),
123
gtk_widget_get_state (widget),
125
area, widget, "handlebox",
126
frame->priv->handle_rect.x,
127
frame->priv->handle_rect.y,
128
frame->priv->handle_rect.width,
129
frame->priv->handle_rect.height,
135
panel_applet_frame_expose (GtkWidget *widget,
136
GdkEventExpose *event)
138
if (gtk_widget_is_drawable (widget)) {
139
GTK_WIDGET_CLASS (panel_applet_frame_parent_class)->expose_event (widget, event);
141
panel_applet_frame_paint (widget, &event->area);
148
panel_applet_frame_update_background_size (PanelAppletFrame *frame,
149
GtkAllocation *old_allocation,
150
GtkAllocation *new_allocation)
152
PanelBackground *background;
154
if (old_allocation->x == new_allocation->x &&
155
old_allocation->y == new_allocation->y &&
156
old_allocation->width == new_allocation->width &&
157
old_allocation->height == new_allocation->height)
160
background = &frame->priv->panel->background;
162
if (background->type == PANEL_BACK_NONE ||
163
(background->type == PANEL_BACK_COLOR && !background->has_alpha))
166
panel_applet_frame_change_background (frame, background->type);
170
panel_applet_frame_size_request (GtkWidget *widget,
171
GtkRequisition *requisition)
173
PanelAppletFrame *frame;
176
GtkRequisition child_requisition;
179
frame = PANEL_APPLET_FRAME (widget);
180
bin = GTK_BIN (widget);
182
if (!frame->priv->has_handle) {
183
GTK_WIDGET_CLASS (panel_applet_frame_parent_class)->size_request (widget, requisition);
187
child = gtk_bin_get_child (bin);
188
if (child && gtk_widget_get_visible (child)) {
189
gtk_widget_size_request (child, &child_requisition);
191
requisition->width = child_requisition.width;
192
requisition->height = child_requisition.height;
195
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
196
requisition->width += border_width;
197
requisition->height += border_width;
199
switch (frame->priv->orientation) {
200
case PANEL_ORIENTATION_TOP:
201
case PANEL_ORIENTATION_BOTTOM:
202
requisition->width += HANDLE_SIZE;
204
case PANEL_ORIENTATION_LEFT:
205
case PANEL_ORIENTATION_RIGHT:
206
requisition->height += HANDLE_SIZE;
209
g_assert_not_reached ();
215
panel_applet_frame_size_allocate (GtkWidget *widget,
216
GtkAllocation *allocation)
218
PanelAppletFrame *frame;
222
GtkAllocation new_allocation;
223
GtkAllocation old_allocation;
224
GtkAllocation widget_allocation;
226
gtk_widget_get_allocation (widget, &widget_allocation);
228
old_allocation.x = widget_allocation.x;
229
old_allocation.y = widget_allocation.y;
230
old_allocation.width = widget_allocation.width;
231
old_allocation.height = widget_allocation.height;
233
frame = PANEL_APPLET_FRAME (widget);
234
bin = GTK_BIN (widget);
236
if (!frame->priv->has_handle) {
237
GTK_WIDGET_CLASS (panel_applet_frame_parent_class)->size_allocate (widget,
239
panel_applet_frame_update_background_size (frame,
245
window = gtk_widget_get_window (widget);
246
child = gtk_bin_get_child (bin);
247
gtk_widget_set_allocation (widget, allocation);
249
frame->priv->handle_rect.x = 0;
250
frame->priv->handle_rect.y = 0;
252
switch (frame->priv->orientation) {
253
case PANEL_ORIENTATION_TOP:
254
case PANEL_ORIENTATION_BOTTOM:
255
frame->priv->handle_rect.width = HANDLE_SIZE;
256
frame->priv->handle_rect.height = allocation->height;
258
if (gtk_widget_get_direction (GTK_WIDGET (frame)) !=
260
frame->priv->handle_rect.x = 0;
261
new_allocation.x = HANDLE_SIZE;
263
frame->priv->handle_rect.x = allocation->width - HANDLE_SIZE;
264
new_allocation.x = 0;
267
new_allocation.y = 0;
268
new_allocation.width = allocation->width - HANDLE_SIZE;
269
new_allocation.height = allocation->height;
271
case PANEL_ORIENTATION_LEFT:
272
case PANEL_ORIENTATION_RIGHT:
273
frame->priv->handle_rect.width = allocation->width;
274
frame->priv->handle_rect.height = HANDLE_SIZE;
276
new_allocation.x = 0;
277
new_allocation.y = HANDLE_SIZE;
278
new_allocation.width = allocation->width;
279
new_allocation.height = allocation->height - HANDLE_SIZE;
282
g_assert_not_reached ();
286
new_allocation.width = MAX (1, new_allocation.width);
287
new_allocation.height = MAX (1, new_allocation.height);
289
/* If the child allocation changed, that means that the frame is drawn
290
* in a new place, so we must redraw the entire widget.
292
if (gtk_widget_get_mapped (widget) &&
293
(new_allocation.x != frame->priv->child_allocation.x ||
294
new_allocation.y != frame->priv->child_allocation.y ||
295
new_allocation.width != frame->priv->child_allocation.width ||
296
new_allocation.height != frame->priv->child_allocation.height))
297
gdk_window_invalidate_rect (window, &widget_allocation, FALSE);
299
if (gtk_widget_get_realized (widget)) {
302
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
303
gdk_window_move_resize (window,
304
allocation->x + border_width,
305
allocation->y + border_width,
306
MAX (allocation->width - border_width * 2, 0),
307
MAX (allocation->height - border_width * 2, 0));
310
if (child && gtk_widget_get_visible (child))
311
gtk_widget_size_allocate (child, &new_allocation);
313
frame->priv->child_allocation = new_allocation;
315
panel_applet_frame_update_background_size (frame,
320
static inline gboolean
321
button_event_in_rect (GdkEventButton *event,
324
if (event->x >= rect->x &&
325
event->x <= (rect->x + rect->width) &&
326
event->y >= rect->y &&
327
event->y <= (rect->y + rect->height))
334
panel_applet_frame_button_changed (GtkWidget *widget,
335
GdkEventButton *event)
337
PanelAppletFrame *frame;
338
gboolean handled = FALSE;
340
frame = PANEL_APPLET_FRAME (widget);
342
if (!frame->priv->has_handle)
345
if (event->window != gtk_widget_get_window (widget))
348
switch (event->button) {
351
if (button_event_in_rect (event, &frame->priv->handle_rect)) {
352
if (event->type == GDK_BUTTON_PRESS ||
353
event->type == GDK_2BUTTON_PRESS) {
354
panel_widget_applet_drag_start (
355
frame->priv->panel, GTK_WIDGET (frame),
356
PW_DRAG_OFF_CURSOR, event->time);
358
} else if (event->type == GDK_BUTTON_RELEASE) {
359
panel_widget_applet_drag_end (frame->priv->panel);
365
if (event->type == GDK_BUTTON_PRESS ||
366
event->type == GDK_2BUTTON_PRESS) {
367
gdk_pointer_ungrab (GDK_CURRENT_TIME);
369
PANEL_APPLET_FRAME_GET_CLASS (frame)->popup_menu (frame,
374
} else if (event->type == GDK_BUTTON_RELEASE)
385
panel_applet_frame_finalize (GObject *object)
387
PanelAppletFrame *frame = PANEL_APPLET_FRAME (object);
389
panel_applets_manager_factory_deactivate (frame->priv->iid);
391
panel_lockdown_notify_remove (G_CALLBACK (panel_applet_frame_sync_menu_state),
394
g_free (frame->priv->iid);
395
frame->priv->iid = NULL;
397
G_OBJECT_CLASS (panel_applet_frame_parent_class)->finalize (object);
401
panel_applet_frame_class_init (PanelAppletFrameClass *klass)
403
GObjectClass *gobject_class = (GObjectClass *) klass;
404
GtkWidgetClass *widget_class = (GtkWidgetClass *) klass;
406
gobject_class->finalize = panel_applet_frame_finalize;
408
widget_class->expose_event = panel_applet_frame_expose;
409
widget_class->size_request = panel_applet_frame_size_request;
410
widget_class->size_allocate = panel_applet_frame_size_allocate;
411
widget_class->button_press_event = panel_applet_frame_button_changed;
412
widget_class->button_release_event = panel_applet_frame_button_changed;
414
g_type_class_add_private (klass, sizeof (PanelAppletFramePrivate));
418
panel_applet_frame_init (PanelAppletFrame *frame)
420
frame->priv = PANEL_APPLET_FRAME_GET_PRIVATE (frame);
422
frame->priv->panel = NULL;
423
frame->priv->orientation = PANEL_ORIENTATION_TOP;
424
frame->priv->applet_info = NULL;
425
frame->priv->has_handle = FALSE;
429
panel_applet_frame_init_properties (PanelAppletFrame *frame)
431
PANEL_APPLET_FRAME_GET_CLASS (frame)->init_properties (frame);
435
panel_applet_frame_sync_menu_state (PanelAppletFrame *frame)
437
PanelWidget *panel_widget;
438
gboolean locked_down;
444
panel_widget = PANEL_WIDGET (gtk_widget_get_parent (GTK_WIDGET (frame)));
446
movable = panel_applet_can_freely_move (frame->priv->applet_info);
447
removable = panel_profile_id_lists_are_writable ();
448
lockable = panel_applet_lockable (frame->priv->applet_info);
450
locked = panel_widget_get_applet_locked (panel_widget, GTK_WIDGET (frame));
451
locked_down = panel_lockdown_get_locked_down ();
453
PANEL_APPLET_FRAME_GET_CLASS (frame)->sync_menu_state (frame, movable, removable, lockable, locked, locked_down);
457
panel_applet_frame_change_orientation (PanelAppletFrame *frame,
458
PanelOrientation orientation)
460
if (orientation == frame->priv->orientation)
463
frame->priv->orientation = orientation;
464
PANEL_APPLET_FRAME_GET_CLASS (frame)->change_orientation (frame, orientation);
468
panel_applet_frame_change_size (PanelAppletFrame *frame,
471
PANEL_APPLET_FRAME_GET_CLASS (frame)->change_size (frame, size);
475
panel_applet_frame_change_background (PanelAppletFrame *frame,
476
PanelBackgroundType type)
480
g_return_if_fail (PANEL_IS_APPLET_FRAME (frame));
482
parent = gtk_widget_get_parent (GTK_WIDGET (frame));
484
g_return_if_fail (PANEL_IS_WIDGET (parent));
486
if (frame->priv->has_handle) {
487
PanelBackground *background;
489
background = &PANEL_WIDGET (parent)->background;
490
panel_background_change_background_on_widget (background,
494
PANEL_APPLET_FRAME_GET_CLASS (frame)->change_background (frame, type);
498
panel_applet_frame_set_panel (PanelAppletFrame *frame,
501
g_return_if_fail (PANEL_IS_APPLET_FRAME (frame));
502
g_return_if_fail (PANEL_IS_WIDGET (panel));
504
frame->priv->panel = panel;
508
_panel_applet_frame_set_iid (PanelAppletFrame *frame,
511
if (frame->priv->iid)
512
g_free (frame->priv->iid);
513
frame->priv->iid = g_strdup (iid);
517
_panel_applet_frame_activated (PanelAppletFrame *frame,
518
PanelAppletFrameActivating *frame_act,
523
g_assert (frame->priv->iid != NULL);
526
g_warning ("Failed to load applet %s:\n%s",
527
frame->priv->iid, error->message);
528
g_error_free (error);
530
panel_applet_frame_loading_failed (frame->priv->iid,
533
panel_applet_frame_activating_free (frame_act);
534
gtk_widget_destroy (GTK_WIDGET (frame));
539
frame->priv->panel = frame_act->panel;
540
gtk_widget_show_all (GTK_WIDGET (frame));
542
info = panel_applet_register (GTK_WIDGET (frame), GTK_WIDGET (frame),
543
NULL, frame->priv->panel,
544
frame_act->locked, frame_act->position,
545
frame_act->exactpos, PANEL_OBJECT_APPLET,
547
frame->priv->applet_info = info;
549
panel_widget_set_applet_size_constrained (frame->priv->panel,
550
GTK_WIDGET (frame), TRUE);
552
panel_applet_frame_sync_menu_state (frame);
553
panel_applet_frame_init_properties (frame);
555
panel_lockdown_notify_add (G_CALLBACK (panel_applet_frame_sync_menu_state),
558
panel_applet_stop_loading (frame_act->id);
559
panel_applet_frame_activating_free (frame_act);
563
_panel_applet_frame_update_flags (PanelAppletFrame *frame,
568
gboolean old_has_handle;
570
panel_widget_set_applet_expandable (
571
frame->priv->panel, GTK_WIDGET (frame), major, minor);
573
old_has_handle = frame->priv->has_handle;
574
frame->priv->has_handle = has_handle;
576
if (!old_has_handle && frame->priv->has_handle) {
577
/* we've added an handle, so we need to get the background for
579
PanelBackground *background;
581
background = &frame->priv->panel->background;
582
panel_applet_frame_change_background (frame, background->type);
587
_panel_applet_frame_update_size_hints (PanelAppletFrame *frame,
591
if (frame->priv->has_handle) {
592
gint extra_size = HANDLE_SIZE + 1;
595
for (i = 0; i < n_elements; i++)
596
size_hints[i] += extra_size;
599
/* It takes the ownership of size-hints array */
600
panel_widget_set_applet_size_hints (frame->priv->panel,
607
_panel_applet_frame_get_background_string (PanelAppletFrame *frame,
609
PanelBackgroundType type)
611
GtkAllocation allocation;
615
gtk_widget_get_allocation (GTK_WIDGET (frame), &allocation);
620
if (frame->priv->has_handle) {
621
switch (frame->priv->orientation) {
622
case PANEL_ORIENTATION_TOP:
623
case PANEL_ORIENTATION_BOTTOM:
624
if (gtk_widget_get_direction (GTK_WIDGET (frame)) !=
626
x += frame->priv->handle_rect.width;
628
case PANEL_ORIENTATION_LEFT:
629
case PANEL_ORIENTATION_RIGHT:
630
y += frame->priv->handle_rect.height;
633
g_assert_not_reached ();
638
return panel_background_make_string (&panel->background, x, y);
642
panel_applet_frame_reload_response (GtkWidget *dialog,
644
PanelAppletFrame *frame)
648
g_return_if_fail (PANEL_IS_APPLET_FRAME (frame));
650
if (!frame->priv->iid || !frame->priv->panel) {
651
g_object_unref (frame);
652
gtk_widget_destroy (dialog);
656
info = frame->priv->applet_info;
658
if (response == GTK_RESPONSE_YES) {
663
gboolean locked = FALSE;
665
panel = frame->priv->panel;
666
iid = g_strdup (frame->priv->iid);
669
id = g_strdup (info->id);
670
position = panel_applet_get_position (info);
671
locked = panel_widget_get_applet_locked (panel, info->widget);
672
panel_applet_clean (info);
675
panel_applet_frame_load (iid, panel, locked,
682
/* if we can't write to applets list we can't really delete
683
it, so we'll just ignore this. FIXME: handle this
684
more correctly I suppose. */
685
if (panel_profile_id_lists_are_writable ())
686
panel_profile_delete_object (info);
689
g_object_unref (frame);
690
gtk_widget_destroy (dialog);
694
_panel_applet_frame_applet_broken (PanelAppletFrame *frame)
698
const char *applet_name = NULL;
701
screen = gtk_widget_get_screen (GTK_WIDGET (frame));
703
if (xstuff_is_display_dead ())
706
if (frame->priv->iid) {
707
PanelAppletInfo *info;
709
info = (PanelAppletInfo *)panel_applets_manager_get_applet_info (frame->priv->iid);
710
applet_name = panel_applet_info_get_name (info);
714
dialog_txt = g_strdup_printf (_("\"%s\" has quit unexpectedly"), applet_name);
716
dialog_txt = g_strdup (_("Panel object has quit unexpectedly"));
718
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
719
GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
720
dialog_txt, applet_name ? applet_name : NULL);
722
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
723
_("If you reload a panel object, it will automatically "
724
"be added back to the panel."));
726
gtk_container_set_border_width (GTK_CONTAINER (dialog), 6);
728
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
729
_("_Don't Reload"), GTK_RESPONSE_NO,
730
_("_Reload"), GTK_RESPONSE_YES,
733
gtk_dialog_set_default_response (GTK_DIALOG (dialog),
736
gtk_window_set_screen (GTK_WINDOW (dialog), screen);
738
g_signal_connect (dialog, "response",
739
G_CALLBACK (panel_applet_frame_reload_response),
740
g_object_ref (frame));
742
panel_widget_register_open_dialog (frame->priv->panel, dialog);
743
gtk_window_set_urgency_hint (GTK_WINDOW (dialog), TRUE);
744
/* FIXME: http://bugzilla.gnome.org/show_bug.cgi?id=165132 */
745
gtk_window_set_title (GTK_WINDOW (dialog), _("Error"));
747
gtk_widget_show (dialog);
752
_panel_applet_frame_applet_remove (PanelAppletFrame *frame)
756
if (!frame->priv->applet_info)
759
info = frame->priv->applet_info;
760
frame->priv->applet_info = NULL;
762
panel_profile_delete_object (info);
766
_panel_applet_frame_applet_move (PanelAppletFrame *frame)
768
GtkWidget *widget = GTK_WIDGET (frame);
769
GtkWidget *parent = gtk_widget_get_parent (widget);
771
if (!PANEL_IS_WIDGET (parent))
774
panel_widget_applet_drag_start (PANEL_WIDGET (parent),
781
_panel_applet_frame_applet_lock (PanelAppletFrame *frame,
784
PanelWidget *panel_widget = PANEL_WIDGET (gtk_widget_get_parent (GTK_WIDGET (frame)));
786
if (panel_widget_get_applet_locked (panel_widget, GTK_WIDGET (frame)) == locked)
789
panel_applet_toggle_locked (frame->priv->applet_info);
792
/* Generic methods */
794
static GSList *no_reload_applets = NULL;
797
LOADING_FAILED_RESPONSE_DONT_DELETE,
798
LOADING_FAILED_RESPONSE_DELETE
802
panel_applet_frame_activating_free (PanelAppletFrameActivating *frame_act)
804
g_free (frame_act->id);
805
g_slice_free (PanelAppletFrameActivating, frame_act);
809
panel_applet_frame_activating_get_orientation (PanelAppletFrameActivating *frame_act)
811
return panel_widget_get_applet_orientation (frame_act->panel);
815
panel_applet_frame_activating_get_size (PanelAppletFrameActivating *frame_act)
817
return frame_act->panel->sz;
821
panel_applet_frame_activating_get_locked (PanelAppletFrameActivating *frame_act)
823
return frame_act->locked;
827
panel_applet_frame_activating_get_locked_down (PanelAppletFrameActivating *frame_act)
829
return panel_lockdown_get_locked_down ();
833
panel_applet_frame_activating_get_conf_path (PanelAppletFrameActivating *frame_act)
835
return g_strdup_printf (PANEL_APPLET_PREFS_KEY, frame_act->id);
839
panel_applet_frame_loading_failed_response (GtkWidget *dialog,
843
gtk_widget_destroy (dialog);
845
if (response == LOADING_FAILED_RESPONSE_DELETE &&
846
!panel_lockdown_get_locked_down () &&
847
panel_profile_id_lists_are_writable ()) {
850
item = g_slist_find_custom (no_reload_applets, id,
851
(GCompareFunc) strcmp);
854
no_reload_applets = g_slist_delete_link (no_reload_applets,
858
panel_profile_remove_from_list (PANEL_GCONF_APPLETS, id);
865
panel_applet_frame_loading_failed (const char *iid,
871
gboolean locked_down;
873
no_reload_applets = g_slist_prepend (no_reload_applets,
876
locked_down = panel_lockdown_get_locked_down ();
878
problem_txt = g_strdup_printf (_("The panel encountered a problem "
879
"while loading \"%s\"."),
882
dialog = gtk_message_dialog_new (NULL, 0,
883
locked_down ? GTK_MESSAGE_INFO : GTK_MESSAGE_WARNING,
886
g_free (problem_txt);
889
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
890
GTK_STOCK_OK, LOADING_FAILED_RESPONSE_DONT_DELETE,
893
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
894
_("Do you want to delete the applet "
895
"from your configuration?"));
896
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
897
PANEL_STOCK_DONT_DELETE, LOADING_FAILED_RESPONSE_DONT_DELETE,
898
GTK_STOCK_DELETE, LOADING_FAILED_RESPONSE_DELETE,
902
gtk_dialog_set_default_response (GTK_DIALOG (dialog),
903
LOADING_FAILED_RESPONSE_DONT_DELETE);
905
gtk_window_set_screen (GTK_WINDOW (dialog),
906
gtk_window_get_screen (GTK_WINDOW (panel->toplevel)));
908
g_signal_connect (dialog, "response",
909
G_CALLBACK (panel_applet_frame_loading_failed_response),
912
panel_widget_register_open_dialog (panel, dialog);
913
gtk_window_set_urgency_hint (GTK_WINDOW (dialog), TRUE);
914
/* FIXME: http://bugzilla.gnome.org/show_bug.cgi?id=165132 */
915
gtk_window_set_title (GTK_WINDOW (dialog), _("Error"));
917
gtk_widget_show_all (dialog);
919
/* Note: this call will free the memory for id, so the variable should
920
* not get accessed afterwards. */
921
panel_applet_stop_loading (id);
925
panel_applet_frame_load (const gchar *iid,
932
PanelAppletFrameActivating *frame_act;
934
g_return_if_fail (iid != NULL);
935
g_return_if_fail (panel != NULL);
936
g_return_if_fail (id != NULL);
938
if (g_slist_find_custom (no_reload_applets, id,
939
(GCompareFunc) strcmp)) {
940
panel_applet_stop_loading (id);
944
if (panel_lockdown_is_applet_disabled (iid)) {
945
panel_applet_stop_loading (id);
949
frame_act = g_slice_new0 (PanelAppletFrameActivating);
950
frame_act->locked = locked;
951
frame_act->panel = panel;
952
frame_act->position = position;
953
frame_act->exactpos = exactpos;
954
frame_act->id = g_strdup (id);
956
if (!panel_applets_manager_load_applet (iid, frame_act)) {
957
panel_applet_frame_loading_failed (iid, panel, id);
958
panel_applet_frame_activating_free (frame_act);
963
panel_applet_frame_load_from_gconf (PanelWidget *panel_widget,
970
g_return_if_fail (panel_widget != NULL);
971
g_return_if_fail (id != NULL);
973
applet_iid = panel_compatibility_get_applet_iid (id);
975
panel_applet_stop_loading (id);
979
panel_applet_frame_load (applet_iid, panel_widget,
980
locked, position, TRUE, id);
986
panel_applet_frame_create (PanelToplevel *toplevel,
994
g_return_if_fail (iid != NULL);
996
client = panel_gconf_get_client ();
998
id = panel_profile_prepare_object (PANEL_OBJECT_APPLET, toplevel, position, FALSE);
1000
key = panel_gconf_full_key (PANEL_GCONF_APPLETS, id, "applet_iid");
1001
gconf_client_set_string (client, key, iid, NULL);
1003
panel_profile_add_to_list (PANEL_GCONF_APPLETS, id);