/* * Copyright (c) 2008 Stephan Arts * Copyright (c) 2008-2009 Mike Massonnet * Copyright (c) 2009 Jannis Pohlmann * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include "twp-provider.h" #define XFDESKTOP_SELECTION_FMT "XFDESKTOP_SELECTION_%d" #define NAUTILUS_SELECTION_FMT "NAUTILUS_DESKTOP_WINDOW_ID" static void twp_menu_provider_init (ThunarxMenuProviderIface *iface); static void twp_provider_finalize (GObject *object); static GList *twp_provider_get_file_actions (ThunarxMenuProvider *menu_provider, GtkWidget *window, GList *files); static void twp_action_set_wallpaper (GtkAction *action, gpointer user_data); struct _TwpProviderClass { GObjectClass __parent__; }; struct _TwpProvider { GObject __parent__; gchar *child_watch_path; gint child_watch_id; }; THUNARX_DEFINE_TYPE_WITH_CODE (TwpProvider, twp_provider, G_TYPE_OBJECT, THUNARX_IMPLEMENT_INTERFACE (THUNARX_TYPE_MENU_PROVIDER, twp_menu_provider_init)); static void twp_menu_provider_init (ThunarxMenuProviderIface *iface) { iface->get_file_actions = twp_provider_get_file_actions; } static void twp_provider_class_init (TwpProviderClass *klass) { GObjectClass *gobject_class; gobject_class = G_OBJECT_CLASS (klass); gobject_class->finalize = twp_provider_finalize; } static void twp_provider_init (TwpProvider *twp_provider) { } static void twp_provider_finalize (GObject *object) { G_OBJECT_CLASS (twp_provider_parent_class)->finalize (object); } static GList* twp_provider_get_file_actions (ThunarxMenuProvider *menu_provider, GtkWidget *window, GList *files) { GtkAction *action = NULL; GList *actions = NULL; GtkWidget *item = NULL; GtkWidget *menu = NULL; GtkAction *subaction = NULL; GtkWidget *subitem = NULL; action = gtk_action_new("Txp::menuitem", "Menu Parent", "Menu Parent", NULL); item = gtk_action_create_menu_item (action); menu = gtk_menu_new(); gtk_menu_item_set_submenu(GTK_MENU_ITEM (item), menu); subaction = gtk_action_new("Txp::submenuitem", "Submenu item", "Submenu Item", NULL); g_signal_connect (subaction, "activate", G_CALLBACK (twp_action_set_wallpaper), files->data); subitem = gtk_action_create_menu_item(subaction); gtk_menu_shell_append(GTK_MENU_SHELL(menu), subitem); gtk_widget_show(subitem); actions = g_list_append (actions, action); return actions; } static void twp_action_set_wallpaper (GtkAction *action, gpointer user_data) { g_print("twp_action_set_wallpaper\n"); }