static void xfce_panel_image_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { switch (prop_id) { case PROP_SOURCE: xfce_panel_image_set_from_source (XFCE_PANEL_IMAGE (object), g_value_get_string (value)); break; case PROP_PIXBUF: xfce_panel_image_set_from_pixbuf (XFCE_PANEL_IMAGE (object), g_value_get_object (value)); break; case PROP_SIZE: xfce_panel_image_set_size (XFCE_PANEL_IMAGE (object), g_value_get_int (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static void on_icon_changed(WnckWindow *controlwindow, WindowckPlugin *wckp) { GdkPixbuf *pixbuf = NULL; GdkPixbuf *grayscale = NULL; if (!controlwindow) { xfce_panel_image_clear(XFCE_PANEL_IMAGE (wckp->icon->symbol)); } else if (wckp->prefs->show_on_desktop) { gtk_widget_set_sensitive (wckp->icon->symbol, TRUE); if (wnck_window_get_window_type (controlwindow) == WNCK_WINDOW_DESKTOP) { if (!wnck_window_is_active(controlwindow)) gtk_widget_set_sensitive (wckp->icon->symbol, FALSE); xfce_panel_image_set_from_source (XFCE_PANEL_IMAGE (wckp->icon->symbol),GTK_STOCK_HOME); } } if (controlwindow && wnck_window_get_window_type (controlwindow) != WNCK_WINDOW_DESKTOP) { /* This only returns a pointer - it SHOULDN'T be unrefed! */ if (XFCE_PANEL_IS_SMALL) pixbuf = wnck_window_get_mini_icon(controlwindow); else pixbuf = wnck_window_get_icon(controlwindow); /* leave when there is no valid pixbuf */ if (G_UNLIKELY (pixbuf == NULL)) { xfce_panel_image_clear (XFCE_PANEL_IMAGE (wckp->icon->symbol)); return; } if (!wnck_window_is_active(controlwindow)) { /* icon color is set to grayscale */ grayscale = gdk_pixbuf_copy(pixbuf); gdk_pixbuf_saturate_and_pixelate(grayscale, grayscale, 0, FALSE); if (G_UNLIKELY (grayscale != NULL)) pixbuf = grayscale; } xfce_panel_image_set_from_pixbuf(XFCE_PANEL_IMAGE (wckp->icon->symbol), pixbuf); } if (grayscale != NULL && grayscale != pixbuf) g_object_unref (G_OBJECT (grayscale)); }
void exitbutton_save(XfcePanelPlugin *plugin, ExitbuttonPlugin *exitbutton) { if (exo_str_is_empty(exitbutton->icon_name)) { return; } // Update the icon xfce_panel_image_set_from_source(XFCE_PANEL_IMAGE(exitbutton->icon), exitbutton->icon_name); /******************************************************** * Save the properties ********************************************************/ XfceRc *rc; gchar *file; /* get the config file location */ file = xfce_panel_plugin_save_location(plugin, TRUE); if (G_UNLIKELY (file == NULL)) { DBG("Failed to open config file"); return; } /* open the config file, read/write */ rc = xfce_rc_simple_open(file, FALSE); g_free(file); if (G_LIKELY (rc != NULL)) { /* save the settings */ DBG("."); if (exitbutton->icon_name) xfce_rc_write_entry(rc, "icon_name", exitbutton->icon_name); /* close the rc file */ xfce_rc_close(rc); } }