517
664
g_object_notify (G_OBJECT (applet), "orient");
521
/* Locked should not be public API: it's not useful for applet writers to know
522
* if the applet is locked (as opposed to locked_down). */
524
panel_applet_get_locked (PanelApplet *applet)
526
g_return_val_if_fail (PANEL_IS_APPLET (applet), FALSE);
528
return applet->priv->locked;
533
panel_applet_set_locked (PanelApplet *applet,
538
g_return_if_fail (PANEL_IS_APPLET (applet));
540
if (applet->priv->locked == locked)
543
applet->priv->locked = locked;
545
action = panel_applet_menu_get_action (applet, "Lock");
546
g_signal_handlers_block_by_func (action,
547
panel_applet_menu_cmd_lock,
549
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), locked);
550
g_signal_handlers_unblock_by_func (action,
551
panel_applet_menu_cmd_lock,
554
panel_applet_menu_update_actions (applet);
556
g_object_notify (G_OBJECT (applet), "locked");
558
if (applet->priv->connection) {
559
GError *error = NULL;
561
g_dbus_connection_emit_signal (applet->priv->connection,
563
applet->priv->object_path,
564
PANEL_APPLET_INTERFACE,
565
locked ? "Lock" : "Unlock",
568
g_printerr ("Failed to send signal %s: %s\n",
569
locked ? "Lock" : "Unlock",
571
g_error_free (error);
668
* panel_applet_get_locked_down:
669
* @applet: a #PanelApplet.
671
* Gets whether the panel @applet is on is locked down or not. A locked down
672
* applet should not allow any change to its configuration.
674
* Returns: %TRUE if the panel @applet is on is locked down, %FALSE otherwise.
577
677
panel_applet_get_locked_down (PanelApplet *applet)
1130
1291
static gboolean
1131
panel_applet_popup_menu (GtkWidget *widget)
1133
panel_applet_menu_popup (PANEL_APPLET (widget), 3, GDK_CURRENT_TIME);
1139
panel_applet_size_request (GtkWidget *widget, GtkRequisition *requisition)
1141
int focus_width = 0;
1143
GTK_WIDGET_CLASS (panel_applet_parent_class)->size_request (widget,
1146
if (!panel_applet_can_focus (widget))
1150
* We are deliberately ignoring focus-padding here to
1151
* save valuable panel real estate.
1153
gtk_widget_style_get (widget,
1154
"focus-line-width", &focus_width,
1157
requisition->width += 2 * focus_width;
1158
requisition->height += 2 * focus_width;
1292
panel_applet_key_press_event (GtkWidget *widget,
1295
gboolean is_popup = FALSE;
1296
gboolean is_edit_popup = FALSE;
1298
panel_applet_bindings_key_event_is_popup (event, &is_popup, &is_edit_popup);
1301
panel_applet_edit_menu_popup (PANEL_APPLET (widget), 3, event->time);
1303
panel_applet_menu_popup (PANEL_APPLET (widget), 3, event->time);
1305
return (is_popup || is_edit_popup);
1308
static GtkSizeRequestMode
1309
panel_applet_get_request_mode (GtkWidget *widget)
1311
PanelApplet *applet = PANEL_APPLET (widget);
1312
PanelAppletOrient orientation;
1314
orientation = panel_applet_get_orient (applet);
1315
if (orientation == PANEL_APPLET_ORIENT_UP ||
1316
orientation == PANEL_APPLET_ORIENT_DOWN)
1317
return GTK_SIZE_REQUEST_HEIGHT_FOR_WIDTH;
1319
return GTK_SIZE_REQUEST_WIDTH_FOR_HEIGHT;
1323
panel_applet_get_preferred_width (GtkWidget *widget,
1327
int focus_width = 0;
1329
GTK_WIDGET_CLASS (panel_applet_parent_class)->get_preferred_width (widget,
1332
if (!panel_applet_can_focus (widget))
1335
/* We are deliberately ignoring focus-padding here to
1336
* save valuable panel real estate.
1338
gtk_widget_style_get (widget,
1339
"focus-line-width", &focus_width,
1342
*minimum_width += 2 * focus_width;
1343
*natural_width += 2 * focus_width;
1347
panel_applet_get_preferred_height (GtkWidget *widget,
1348
int *minimum_height,
1349
int *natural_height)
1351
int focus_width = 0;
1353
GTK_WIDGET_CLASS (panel_applet_parent_class)->get_preferred_height (widget,
1356
if (!panel_applet_can_focus (widget))
1359
/* We are deliberately ignoring focus-padding here to
1360
* save valuable panel real estate.
1362
gtk_widget_style_get (widget,
1363
"focus-line-width", &focus_width,
1366
*minimum_height += 2 * focus_width;
1367
*natural_height += 2 * focus_width;
1314
panel_applet_parse_color (const gchar *color_str,
1319
g_assert (color_str && color);
1321
if (sscanf (color_str, "%4x%4x%4x", &r, &g, &b) != 3)
1332
panel_applet_parse_pixmap_str (const char *str,
1333
GdkNativeWindow *xid,
1340
g_return_val_if_fail (str != NULL, FALSE);
1341
g_return_val_if_fail (xid != NULL, FALSE);
1342
g_return_val_if_fail (x != NULL, FALSE);
1343
g_return_val_if_fail (y != NULL, FALSE);
1345
elements = g_strsplit (str, ",", -1);
1350
if (!elements [0] || !*elements [0] ||
1351
!elements [1] || !*elements [1] ||
1352
!elements [2] || !*elements [2])
1353
goto ERROR_AND_FREE;
1355
*xid = strtol (elements [0], &tmp, 10);
1356
if (tmp == elements [0])
1357
goto ERROR_AND_FREE;
1359
*x = strtol (elements [1], &tmp, 10);
1360
if (tmp == elements [1])
1361
goto ERROR_AND_FREE;
1363
*y = strtol (elements [2], &tmp, 10);
1364
if (tmp == elements [2])
1365
goto ERROR_AND_FREE;
1367
g_strfreev (elements);
1371
g_strfreev (elements);
1376
panel_applet_get_pixmap (PanelApplet *applet,
1377
GdkNativeWindow xid,
1381
gboolean display_grabbed;
1383
GdkDisplay *display;
1521
static cairo_surface_t *
1522
panel_applet_create_foreign_surface_for_display (GdkDisplay *display,
1528
guint width, height, border, depth;
1530
if (!XGetGeometry (GDK_DISPLAY_XDISPLAY (display), xid, &window,
1531
&x, &y, &width, &height, &border, &depth))
1534
return cairo_xlib_surface_create (GDK_DISPLAY_XDISPLAY (display),
1535
xid, gdk_x11_visual_get_xvisual (visual),
1539
static cairo_pattern_t *
1540
panel_applet_get_pattern_from_pixmap (PanelApplet *applet,
1385
1545
GdkWindow *window;
1389
cairo_pattern_t *pattern;
1549
cairo_surface_t *background;
1550
cairo_surface_t *surface;
1551
cairo_matrix_t matrix;
1552
cairo_pattern_t *pattern;
1391
1554
g_return_val_if_fail (PANEL_IS_APPLET (applet), NULL);
1393
1556
if (!gtk_widget_get_realized (GTK_WIDGET (applet)))
1396
display = gdk_display_get_default ();
1397
display_grabbed = FALSE;
1399
window = gtk_widget_get_window (GTK_WIDGET (applet));
1401
pixmap = gdk_pixmap_lookup_for_display (display, xid);
1403
g_object_ref (pixmap);
1405
display_grabbed = TRUE;
1406
gdk_x11_display_grab (display);
1407
pixmap = gdk_pixmap_foreign_new_for_display (display, xid);
1410
/* This can happen if the user changes the background very fast.
1411
* We'll get the next update, so it's not a big deal. */
1412
if (pixmap == NULL) {
1413
if (display_grabbed)
1414
gdk_x11_display_ungrab (display);
1418
gdk_drawable_get_size (GDK_DRAWABLE (window), &width, &height);
1419
retval = gdk_pixmap_new (window, width, height, -1);
1421
/* the pixmap has no colormap, and we need one */
1422
gdk_drawable_set_colormap (GDK_DRAWABLE (pixmap),
1423
gdk_drawable_get_colormap (window));
1425
cr = gdk_cairo_create (GDK_DRAWABLE (retval));
1426
gdk_cairo_set_source_pixmap (cr, pixmap, -x, -y);
1427
pattern = cairo_get_source (cr);
1428
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
1430
cairo_rectangle (cr, 0, 0, width, height);
1435
g_object_unref (pixmap);
1437
if (display_grabbed)
1438
gdk_x11_display_ungrab (display);
1559
window = gtk_widget_get_window (GTK_WIDGET (applet));
1561
gdk_error_trap_push ();
1562
background = panel_applet_create_foreign_surface_for_display (gdk_window_get_display (window),
1563
gdk_window_get_visual (window),
1565
gdk_error_trap_pop_ignored ();
1567
/* background can be NULL if the user changes the background very fast.
1568
* We'll get the next update, so it's not a big deal. */
1570
cairo_surface_status (background) != CAIRO_STATUS_SUCCESS) {
1572
cairo_surface_destroy (background);
1576
width = gdk_window_get_width (window);
1577
height = gdk_window_get_height (window);
1578
surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height);
1580
gdk_error_trap_push ();
1581
cr = cairo_create (surface);
1582
cairo_set_source_surface (cr, background, -x, -y);
1583
cairo_rectangle (cr, 0, 0, width, height);
1585
gdk_error_trap_pop_ignored ();
1587
cairo_surface_destroy (background);
1591
if (cairo_status (cr) == CAIRO_STATUS_SUCCESS) {
1592
pattern = cairo_pattern_create_for_surface (surface);
1593
cairo_matrix_init_translate (&matrix, 0, 0);
1594
cairo_matrix_scale (&matrix, width, height);
1595
cairo_pattern_set_matrix (pattern, &matrix);
1596
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_PAD);
1600
cairo_surface_destroy (surface);
1443
static PanelAppletBackgroundType
1444
panel_applet_handle_background_string (PanelApplet *applet,
1606
* panel_applet_get_background:
1607
* @applet: a #PanelApplet.
1609
* Gets the background pattern for @applet, or %NULL if there is none.
1611
* Returns: (transfer full): a new #cairo_pattern_t to use as background for
1615
panel_applet_get_background (PanelApplet *applet)
1448
PanelAppletBackgroundType retval;
1617
cairo_pattern_t *pattern = NULL;
1620
GError *error = NULL;
1451
retval = PANEL_NO_BACKGROUND;
1622
g_return_val_if_fail (PANEL_IS_APPLET (applet), NULL);
1453
1624
if (!gtk_widget_get_realized (GTK_WIDGET (applet)) || !applet->priv->background)
1456
elements = g_strsplit (applet->priv->background, ":", -1);
1458
if (elements [0] && !strcmp (elements [0], "none" )) {
1459
retval = PANEL_NO_BACKGROUND;
1461
} else if (elements [0] && !strcmp (elements [0], "color")) {
1462
g_return_val_if_fail (color != NULL, PANEL_NO_BACKGROUND);
1464
if (!elements [1] || !panel_applet_parse_color (elements [1], color)) {
1466
g_warning ("Incomplete '%s' background type received", elements [0]);
1467
g_strfreev (elements);
1468
return PANEL_NO_BACKGROUND;
1471
retval = PANEL_COLOR_BACKGROUND;
1473
} else if (elements [0] && !strcmp (elements [0], "pixmap")) {
1474
GdkNativeWindow pixmap_id;
1477
g_return_val_if_fail (pixmap != NULL, PANEL_NO_BACKGROUND);
1479
if (!panel_applet_parse_pixmap_str (elements [1], &pixmap_id, &x, &y)) {
1480
g_warning ("Incomplete '%s' background type received: %s",
1481
elements [0], elements [1]);
1483
g_strfreev (elements);
1484
return PANEL_NO_BACKGROUND;
1487
*pixmap = panel_applet_get_pixmap (applet, pixmap_id, x, y);
1489
g_warning ("Failed to get pixmap %s", elements [1]);
1490
g_strfreev (elements);
1491
return PANEL_NO_BACKGROUND;
1494
retval = PANEL_PIXMAP_BACKGROUND;
1496
g_warning ("Unknown background type received");
1498
g_strfreev (elements);
1503
PanelAppletBackgroundType
1504
panel_applet_get_background (PanelApplet *applet,
1508
g_return_val_if_fail (PANEL_IS_APPLET (applet), PANEL_NO_BACKGROUND);
1510
/* initial sanity */
1514
memset (color, 0, sizeof (GdkColor));
1516
return panel_applet_handle_background_string (applet, color, pixmap);
1627
variant = g_variant_parse (NULL, applet->priv->background,
1628
NULL, NULL, &error);
1630
g_warning ("Error parsing background %s: %s\n", applet->priv->background, error->message);
1631
g_error_free (error);
1635
g_variant_iter_init (&iter, variant);
1636
switch (g_variant_iter_n_children (&iter)) {
1638
gdouble red, green, blue, alpha;
1640
g_variant_get (variant, "(dddd)", &red, &green, &blue, &alpha);
1641
pattern = cairo_pattern_create_rgba (red, green, blue, alpha);
1648
g_variant_get (variant, "(uii)", &xid, &x, &y);
1649
pattern = panel_applet_get_pattern_from_pixmap (applet, xid, x, y);
1651
g_warning ("Failed to get pixmap %d, %d, %d", xid, x, y);
1658
g_variant_unref (variant);
1534
1678
g_object_notify (G_OBJECT (applet), "background");
1538
panel_applet_update_background_for_widget (GtkWidget *widget,
1539
PanelAppletBackgroundType type,
1543
GtkRcStyle *rc_style;
1547
gtk_widget_set_style (widget, NULL);
1548
rc_style = gtk_rc_style_new ();
1549
gtk_widget_modify_style (widget, rc_style);
1550
g_object_unref (rc_style);
1553
case PANEL_NO_BACKGROUND:
1555
case PANEL_COLOR_BACKGROUND:
1556
gtk_widget_modify_bg (widget, GTK_STATE_NORMAL, color);
1558
case PANEL_PIXMAP_BACKGROUND:
1559
style = gtk_style_copy (gtk_widget_get_style (widget));
1560
if (style->bg_pixmap[GTK_STATE_NORMAL])
1561
g_object_unref (style->bg_pixmap[GTK_STATE_NORMAL]);
1562
style->bg_pixmap[GTK_STATE_NORMAL] = g_object_ref (pixmap);
1563
gtk_widget_set_style (widget, style);
1564
g_object_unref (style);
1567
g_assert_not_reached ();
1681
static GtkStyleProperties *
1682
_panel_applet_get_widget_style_properties (GtkWidget *widget,
1683
gboolean create_if_needed)
1685
GtkStyleProperties *properties;
1687
properties = g_object_get_data (G_OBJECT (widget),
1688
"panel-applet-style-props");
1690
if (!properties && create_if_needed) {
1691
properties = gtk_style_properties_new ();
1692
g_object_set_data_full (G_OBJECT (widget),
1693
"panel-applet-style-props",
1695
(GDestroyNotify) g_object_unref);
1702
_panel_applet_reset_widget_style_properties (GtkWidget *widget)
1704
GtkStyleProperties *properties;
1706
properties = _panel_applet_get_widget_style_properties (widget, FALSE);
1709
gtk_style_context_remove_provider (gtk_widget_get_style_context (widget),
1710
GTK_STYLE_PROVIDER (properties));
1712
g_object_set_data (G_OBJECT (widget), "panel-applet-style-props", NULL);
1716
panel_applet_update_background_for_widget (GtkWidget *widget,
1717
cairo_pattern_t *pattern)
1719
GtkStyleProperties *properties;
1721
gtk_widget_reset_style (widget);
1724
_panel_applet_reset_widget_style_properties (widget);
1728
properties = _panel_applet_get_widget_style_properties (widget, TRUE);
1730
switch (cairo_pattern_get_type (pattern)) {
1731
case CAIRO_PATTERN_TYPE_SOLID: {
1734
cairo_pattern_get_rgba (pattern, &color.red, &color.green, &color.blue, &color.alpha);
1735
gtk_style_properties_set (properties, GTK_STATE_FLAG_NORMAL,
1736
"background-color", &color,
1737
"background-image", NULL,
1741
case CAIRO_PATTERN_TYPE_SURFACE:
1742
gtk_style_properties_set (properties, GTK_STATE_FLAG_NORMAL,
1743
/* background-color can't be NULL,
1744
* but is ignored anyway */
1745
"background-image", pattern,
1752
/* Note: this actually replaces the old properties, since it's the same
1754
gtk_style_context_add_provider (gtk_widget_get_style_context (widget),
1755
GTK_STYLE_PROVIDER (properties),
1756
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
1573
1760
panel_applet_handle_background (PanelApplet *applet)
1575
PanelAppletBackgroundType type;
1762
cairo_pattern_t *pattern;
1579
type = panel_applet_get_background (applet, &color, &pixmap);
1764
pattern = panel_applet_get_background (applet);
1581
1766
if (applet->priv->background_widget)
1582
1767
panel_applet_update_background_for_widget (applet->priv->background_widget,
1583
type, &color, pixmap);
1586
case PANEL_NO_BACKGROUND:
1587
g_signal_emit (G_OBJECT (applet),
1588
panel_applet_signals [CHANGE_BACKGROUND],
1589
0, PANEL_NO_BACKGROUND, NULL, NULL);
1591
case PANEL_COLOR_BACKGROUND:
1592
g_signal_emit (G_OBJECT (applet),
1593
panel_applet_signals [CHANGE_BACKGROUND],
1594
0, PANEL_COLOR_BACKGROUND, &color, NULL);
1596
case PANEL_PIXMAP_BACKGROUND:
1597
g_signal_emit (G_OBJECT (applet),
1598
panel_applet_signals [CHANGE_BACKGROUND],
1599
0, PANEL_PIXMAP_BACKGROUND, NULL, pixmap);
1601
g_object_unref (pixmap);
1604
g_assert_not_reached ();
1770
g_signal_emit (G_OBJECT (applet),
1771
panel_applet_signals [CHANGE_BACKGROUND],
1774
cairo_pattern_destroy (pattern);
1848
2017
PanelApplet *applet = PANEL_APPLET (object);
1850
panel_applet_register_object (applet);
2019
if (!applet->priv->connection || !applet->priv->closure || !applet->priv->id) {
2020
g_printerr ("Bad use of PanelApplet API: you should not create a PanelApplet object yourself. Please use panel_applet_factory_main() instead.\n");
2021
g_assert_not_reached ();
2024
return panel_applet_register_object (applet);
1854
2028
panel_applet_class_init (PanelAppletClass *klass)
1856
2030
GObjectClass *gobject_class = (GObjectClass *) klass;
1857
GtkObjectClass *object_class = (GtkObjectClass *) klass;
1858
2031
GtkWidgetClass *widget_class = (GtkWidgetClass *) klass;
1859
2032
GtkBindingSet *binding_set;
1861
2034
gobject_class->get_property = panel_applet_get_property;
1862
2035
gobject_class->set_property = panel_applet_set_property;
1863
2036
gobject_class->constructed = panel_applet_constructed;
2037
gobject_class->finalize = panel_applet_finalize;
1864
2039
klass->move_focus_out_of_applet = panel_applet_move_focus_out_of_applet;
1866
2041
widget_class->button_press_event = panel_applet_button_press;
1867
2042
widget_class->button_release_event = panel_applet_button_release;
1868
widget_class->size_request = panel_applet_size_request;
2043
widget_class->key_press_event = panel_applet_key_press_event;
2044
widget_class->get_request_mode = panel_applet_get_request_mode;
2045
widget_class->get_preferred_width = panel_applet_get_preferred_width;
2046
widget_class->get_preferred_height = panel_applet_get_preferred_height;
1869
2047
widget_class->size_allocate = panel_applet_size_allocate;
1870
widget_class->expose_event = panel_applet_expose;
2048
widget_class->draw = panel_applet_draw;
1871
2049
widget_class->focus = panel_applet_focus;
1872
2050
widget_class->realize = panel_applet_realize;
1873
widget_class->popup_menu = panel_applet_popup_menu;
1875
gobject_class->finalize = panel_applet_finalize;
1877
2052
g_type_class_add_private (klass, sizeof (PanelAppletPrivate));
2055
* PanelApplet:id: (skip)
2057
* Implementation detail.
1879
2059
g_object_class_install_property (gobject_class,
1881
2061
g_param_spec_string ("id",
1927
2167
"Panel Applet Background",
1929
2169
G_PARAM_READWRITE));
2171
* PanelApplet:flags:
2173
* The #PanelAppletFlags of the applet.
1930
2175
g_object_class_install_property (gobject_class,
1932
2177
g_param_spec_uint ("flags",
1934
2179
"Panel Applet flags",
1935
0, G_MAXUINT, 0, /* FIXME */
2180
PANEL_APPLET_FLAGS_NONE,
2181
PANEL_APPLET_FLAGS_ALL,
2182
PANEL_APPLET_FLAGS_NONE,
1936
2183
G_PARAM_READWRITE));
2185
* PanelApplet:size-hints:
2187
* The size hints set for the applet. See panel_applet_set_size_hints().
1937
2189
g_object_class_install_property (gobject_class,
1938
2190
PROP_SIZE_HINTS,
1939
2191
/* FIXME: value_array? */
1940
2192
g_param_spec_pointer ("size-hints",
1942
"Panel Applet Size Hints",
1943
G_PARAM_READWRITE));
1944
g_object_class_install_property (gobject_class,
1946
g_param_spec_boolean ("locked",
1948
"Whether Panel Applet is locked",
1950
G_PARAM_READWRITE));
2194
"Size hints of the applet",
2195
G_PARAM_READWRITE));
2197
* PanelApplet:locked-down:
2199
* Whether the panel the applet is on is locked down.
1951
2201
g_object_class_install_property (gobject_class,
1952
2202
PROP_LOCKED_DOWN,
1953
2203
g_param_spec_boolean ("locked-down",
1955
"Whether Panel Applet is locked down",
2205
"Whether the panel the applet is on is locked down",
1957
2207
G_PARAM_READWRITE));
2210
* PanelApplet::change-orient:
2211
* @applet: the #PanelApplet which emitted the signal.
2212
* @orient: the new #PanelAppletOrient of @applet.
2214
* Emitted when the #PanelAppletOrient of @applet has changed.
1959
2216
panel_applet_signals [CHANGE_ORIENT] =
1960
2217
g_signal_new ("change_orient",
1961
2218
G_TYPE_FROM_CLASS (klass),
2561
* panel_applet_factory_main:
2562
* @factory_id: identifier of an applet factory.
2563
* @applet_type: GType of the applet this factory creates.
2564
* @callback: (scope call): callback to be called when a new applet is created.
2565
* @data: (closure): callback data.
2567
* Creates the applet factory for @factory_id, so that the factory can create
2568
* instances of the applet types it is associated with.
2570
* Applet instances created by the applet factory will use @applet_type as
2571
* GType. Unless you subclass #PanelApplet, you should use %PANEL_TYPE_APPLET
2574
* On creation of the applet instances, @callback is called to setup the
2575
* applet. If @callback returns %FALSE, the creation of the applet instance is
2578
* If using C, it is recommended to use #PANEL_APPLET_OUT_PROCESS_FACTORY
2579
* instead as it will create a main() function for you.
2581
* It can only be used once, and is incompatible with the use of
2582
* %PANEL_APPLET_IN_PROCESS_FACTORY and %PANEL_APPLET_OUT_PROCESS_FACTORY.
2584
* Returns: 0 on success, 1 if there is an error.
2587
panel_applet_factory_main (const gchar *factory_id,
2589
PanelAppletFactoryCallback callback,
2592
return _panel_applet_factory_main_internal (factory_id, TRUE, applet_type,
2597
* panel_applet_factory_setup_in_process: (skip)
2598
* @factory_id: identifier of an applet factory.
2599
* @applet_type: GType of the applet this factory creates.
2600
* @callback: (scope call): callback to be called when a new applet is created.
2601
* @data: (closure): callback data.
2603
* Creates the applet factory for @factory_id, so that the factory can create
2604
* instances of the applet types it is associated with.
2606
* Applet instances created by the applet factory will use @applet_type as
2607
* GType. Unless you subclass #PanelApplet, you should use %PANEL_TYPE_APPLET
2610
* On creation of the applet instances, @callback is called to setup the
2611
* applet. If @callback returns %FALSE, the creation of the applet instance is
2614
* It can only be used once, and is incompatible with the use of
2615
* %PANEL_APPLET_IN_PROCESS_FACTORY and %PANEL_APPLET_OUT_PROCESS_FACTORY.
2617
* Returns: 0 on success, 1 if there is an error.
2620
panel_applet_factory_setup_in_process (const gchar *factory_id,
2622
PanelAppletFactoryCallback callback,
2625
return _panel_applet_factory_main_internal (factory_id, FALSE, applet_type,
2630
* panel_applet_set_background_widget:
2631
* @applet: a #PanelApplet.
2632
* @widget: a #GtkWidget.
2634
* Configure #PanelApplet to automatically draw the background of the applet on
2635
* @widget. It is generally enough to call this function with @applet as
2291
2639
panel_applet_set_background_widget (PanelApplet *applet,
2292
2640
GtkWidget *widget)
2294
2642
applet->priv->background_widget = widget;
2297
PanelAppletBackgroundType type;
2644
if (widget && gtk_widget_get_realized (widget)) {
2645
cairo_pattern_t *pattern;
2301
type = panel_applet_get_background (applet, &color, &pixmap);
2302
panel_applet_update_background_for_widget (widget, type,
2304
if (type == PANEL_PIXMAP_BACKGROUND)
2305
g_object_unref (pixmap);
2647
pattern = panel_applet_get_background (applet);
2648
panel_applet_update_background_for_widget (widget, pattern);
2650
cairo_pattern_destroy (pattern);