wck-plugin.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /* $Id$
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 3 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License along
  14. * with this program; if not, write to the Free Software Foundation, Inc.,
  15. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  16. *
  17. * Copyright (C) 2013 Cedric Leporcq <cedl38@gmail.com>
  18. *
  19. */
  20. #ifdef HAVE_CONFIG_H
  21. #include <config.h>
  22. #endif
  23. #include <string.h>
  24. #include <gtk/gtk.h>
  25. #include <libxfce4ui/libxfce4ui.h>
  26. #include "wck-plugin.h"
  27. XfconfChannel *
  28. wck_properties_get_channel (GObject *object_for_weak_ref, const gchar *channel_name)
  29. {
  30. GError *error = NULL;
  31. XfconfChannel *channel;
  32. g_return_val_if_fail (G_IS_OBJECT (object_for_weak_ref), NULL);
  33. if (!xfconf_init (&error))
  34. {
  35. g_critical ("Failed to initialize Xfconf: %s", error->message);
  36. g_error_free (error);
  37. return NULL;
  38. }
  39. //~ channel = xfconf_channel_get (XFCE_PANEL_CHANNEL_NAME);
  40. channel = xfconf_channel_get (channel_name);
  41. g_object_weak_ref (object_for_weak_ref, (GWeakNotify) xfconf_shutdown, NULL);
  42. return channel;
  43. }
  44. void
  45. wck_about (XfcePanelPlugin *plugin, const gchar *icon_name)
  46. {
  47. /* about dialog code. you can use the GtkAboutDialog
  48. * or the XfceAboutInfo widget */
  49. GdkPixbuf *icon;
  50. const gchar *auth[] =
  51. {
  52. "Alessio Piccoli <alepic@geckoblu.net>",
  53. "Cedric Leporcq <cedl38@gmail.com>",
  54. "Felix Krull <f_krull@gmx.de>",
  55. "Pavel Zlámal <zlamal@cesnet.cz>",
  56. "",
  57. "This code is derived from 'Window Applets' from Andrej Belcijan.",
  58. "See http://gnome-look.org/content/show.php?content=103732 for details.",
  59. NULL
  60. };
  61. icon = xfce_panel_pixbuf_from_source(icon_name, NULL, 32);
  62. gtk_show_about_dialog (NULL,
  63. "logo", icon,
  64. "license", xfce_get_license_text(XFCE_LICENSE_TEXT_GPL),
  65. "version", PACKAGE_VERSION,
  66. "program-name", xfce_panel_plugin_get_display_name (plugin),
  67. "comments", xfce_panel_plugin_get_comment (plugin),
  68. "website", PLUGIN_WEBSITE,
  69. "copyright", "Copyright \302\251 2013-2015\n",
  70. "authors", auth,
  71. NULL );
  72. // TODO: add translators.
  73. if (icon)
  74. g_object_unref(G_OBJECT(icon) );
  75. }
  76. GtkWidget *show_refresh_item (XfcePanelPlugin *plugin)
  77. {
  78. GtkWidget *refresh;
  79. refresh = gtk_image_menu_item_new_from_stock (GTK_STOCK_REFRESH, NULL);
  80. xfce_panel_plugin_menu_insert_item(plugin, GTK_MENU_ITEM(refresh));
  81. gtk_widget_show(GTK_WIDGET(refresh));
  82. return refresh;
  83. }