diff options
Diffstat (limited to 'sendto/plugins')
-rw-r--r-- | sendto/plugins/caja-burn/caja-burn.c | 16 | ||||
-rw-r--r-- | sendto/plugins/emailclient/emailclient.c | 10 | ||||
-rw-r--r-- | sendto/plugins/gajim/gajim.c | 12 | ||||
-rw-r--r-- | sendto/plugins/pidgin/pidgin.c | 18 | ||||
-rw-r--r-- | sendto/plugins/removable-devices/removable-devices.c | 11 | ||||
-rw-r--r-- | sendto/plugins/upnp/upnp.c | 59 |
6 files changed, 79 insertions, 47 deletions
diff --git a/sendto/plugins/caja-burn/caja-burn.c b/sendto/plugins/caja-burn/caja-burn.c index 4470dff..80aa7d5 100644 --- a/sendto/plugins/caja-burn/caja-burn.c +++ b/sendto/plugins/caja-burn/caja-burn.c @@ -21,9 +21,13 @@ * Author: Jader Henrique da Silva <[email protected]> */ -#include "config.h" -#include <string.h> +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include <glib/gi18n-lib.h> + +#include <string.h> #include "nst-common.h" #include "caja-sendto-plugin.h" @@ -46,8 +50,10 @@ gboolean init (NstPlugin *plugin) g_print ("Init caja burn plugin\n"); +#ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +#endif /* ENABLE_NLS */ it = gtk_icon_theme_get_default (); gtk_icon_theme_append_search_path (it, DATADIR "/brasero/icons"); @@ -163,12 +169,11 @@ gboolean send_files (NstPlugin *plugin, } static -gboolean destroy (NstPlugin *plugin){ - +gboolean destroy (NstPlugin *plugin) +{ g_object_unref (burn); burn = NULL; return TRUE; - } static @@ -186,4 +191,3 @@ NstPluginInfo plugin_info = { }; NST_INIT_PLUGIN (plugin_info) - diff --git a/sendto/plugins/emailclient/emailclient.c b/sendto/plugins/emailclient/emailclient.c index 189ceb8..cfcf8a9 100644 --- a/sendto/plugins/emailclient/emailclient.c +++ b/sendto/plugins/emailclient/emailclient.c @@ -3,6 +3,7 @@ /* * Copyright (C) 2004 Roberto Majadas <[email protected]> * Copyright (C) 2012 Stefano Karapetsas <[email protected]> + * Copyright (C) 2012-2021 MATE developers. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -23,9 +24,12 @@ * Stefano Karapetsas <[email protected]> */ -#include "config.h" +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif #include <glib/gi18n-lib.h> + #include <string.h> #include "caja-sendto-plugin.h" #include <gio/gio.h> @@ -56,7 +60,6 @@ get_evo_cmd (void) NULL}; guint i; - for (i = 0; cmds[i] != NULL; i++) { tmp = g_find_program_in_path (cmds[i]); if (tmp != NULL) @@ -78,8 +81,10 @@ init (NstPlugin *plugin) g_print ("Init email client plugin\n"); +#ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +#endif /* ENABLE_NLS */ app_info = g_app_info_get_default_for_uri_scheme ("mailto"); if (app_info) { @@ -275,4 +280,3 @@ NstPluginInfo plugin_info = { }; NST_INIT_PLUGIN (plugin_info) - diff --git a/sendto/plugins/gajim/gajim.c b/sendto/plugins/gajim/gajim.c index cfa97f1..ffa5f91 100644 --- a/sendto/plugins/gajim/gajim.c +++ b/sendto/plugins/gajim/gajim.c @@ -22,8 +22,12 @@ * */ -#include "config.h" +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include <glib/gi18n-lib.h> + #include <dbus/dbus.h> #include <dbus/dbus-glib.h> #include "caja-sendto-plugin.h" @@ -37,7 +41,6 @@ const gchar *COMPLETION_PROPS[] = {"name", "jid"}; static GHashTable *jid_table = NULL; static gchar *iconset; - DBusGProxy *proxy = NULL; /* @@ -259,8 +262,10 @@ init (NstPlugin *plugin) { g_print ("Init gajim plugin\n"); +#ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +#endif /* ENABLE_NLS */ /* connect to gajim dbus service */ jid_table = g_hash_table_new (g_str_hash, g_str_equal); @@ -270,7 +275,6 @@ init (NstPlugin *plugin) return TRUE; } - static void _set_pixbuf_from_status (const gchar *show, GdkPixbuf **pixbuf) { @@ -368,7 +372,6 @@ get_contacts_widget (NstPlugin *plugin) gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (completion), renderer, "pixbuf", 0, NULL); - store = gtk_list_store_new (2, GDK_TYPE_PIXBUF, G_TYPE_STRING); if(!add_gajim_contacts_to_model (store)) { gtk_widget_set_sensitive(entry, FALSE); @@ -515,4 +518,3 @@ NstPluginInfo plugin_info = { }; NST_INIT_PLUGIN (plugin_info) - diff --git a/sendto/plugins/pidgin/pidgin.c b/sendto/plugins/pidgin/pidgin.c index 2630f41..d06fd41 100644 --- a/sendto/plugins/pidgin/pidgin.c +++ b/sendto/plugins/pidgin/pidgin.c @@ -25,8 +25,12 @@ * Author: Roberto Majadas <[email protected]> */ -#include "config.h" +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include <glib/gi18n-lib.h> + #include <dbus/dbus.h> #include <dbus/dbus-glib.h> #include "caja-sendto-plugin.h" @@ -79,8 +83,10 @@ init (NstPlugin *plugin) g_print ("Init pidgin plugin\n"); +#ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +#endif /* ENABLE_NLS */ error = NULL; connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error); @@ -230,22 +236,21 @@ add_pidgin_contacts_to_model (GtkTreeStore *store, g_hash_table_iter_init (&hiter, contact_hash); while (g_hash_table_iter_next (&hiter, NULL, (gpointer)&contacts_group)) { - gint accounts; + gint num_accounts; dat = g_ptr_array_index (contacts_group, 0); - accounts = contacts_group->len; + num_accounts = contacts_group->len; gtk_tree_store_append (store, parent, NULL); gtk_tree_store_set (store, parent, COL_ICON, NULL, COL_ALIAS, dat->alias, -1); - gint i; - for (i = 0; i < accounts; ++i) { + for (i = 0; i < num_accounts; ++i) { dat = g_ptr_array_index (contacts_group, i); icon = get_buddy_icon(dat->id); - if (accounts == 1) { + if (num_accounts == 1) { g_value_init(&val, GDK_TYPE_PIXBUF); g_value_set_object (&val, (gpointer)icon); gtk_tree_store_set_value (store, parent, COL_ICON, &val); @@ -385,7 +390,6 @@ gboolean send_files (NstPlugin *plugin, GtkWidget *contact_widget, ContactData *dat; GValue val = {0,}; - if (proxy == NULL) return FALSE; diff --git a/sendto/plugins/removable-devices/removable-devices.c b/sendto/plugins/removable-devices/removable-devices.c index f8f1445..0144be7 100644 --- a/sendto/plugins/removable-devices/removable-devices.c +++ b/sendto/plugins/removable-devices/removable-devices.c @@ -19,9 +19,13 @@ * Bastien Nocera <[email protected]> */ -#include "config.h" -#include <string.h> +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include <glib/gi18n-lib.h> + +#include <string.h> #include <gio/gio.h> #include "nst-common.h" #include "caja-sendto-plugin.h" @@ -147,8 +151,10 @@ init (NstPlugin *plugin) { g_print ("Init removable-devices plugin\n"); +#ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +#endif /* ENABLE_NLS */ vol_monitor = g_volume_monitor_get (); cb = gtk_combo_box_new (); @@ -256,4 +262,3 @@ NstPluginInfo plugin_info = { }; NST_INIT_PLUGIN (plugin_info) - diff --git a/sendto/plugins/upnp/upnp.c b/sendto/plugins/upnp/upnp.c index 4c09e66..b770e37 100644 --- a/sendto/plugins/upnp/upnp.c +++ b/sendto/plugins/upnp/upnp.c @@ -25,9 +25,12 @@ * */ -#include "config.h" +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif #include <glib/gi18n-lib.h> + #include <libgupnp/gupnp.h> #include "caja-sendto-plugin.h" @@ -84,25 +87,37 @@ check_required_actions (GUPnPServiceIntrospection *introspection) } static void -get_introspection_cb (GUPnPServiceInfo *service_info, - GUPnPServiceIntrospection *introspection, const GError *error, - gpointer user_data) +get_introspection_cb (GObject *source_object, + GAsyncResult *res, + gpointer user_data) { GUPnPDeviceInfo *device_info; gchar *name; const gchar *udn, *interface; GtkTreeIter iter; GUPnPContext *context; + GError *error = NULL; device_info = GUPNP_DEVICE_INFO (user_data); - if (introspection != NULL) { - /* If introspection is available, make sure required actions - * are implemented. - */ - if (!check_required_actions (introspection)) - goto error; - } + GUPnPServiceIntrospection *introspection = + gupnp_service_info_introspect_finish (GUPNP_SERVICE_INFO (GUPNP_SERVICE_INFO (source_object)), + res, + &error); + if (error) { + g_warning ("Failed to create introspection for '%s': %s", + gupnp_service_info_get_udn (GUPNP_SERVICE_INFO (source_object)), + error->message); + g_clear_error (&error); + goto error; + } + + /* If introspection is available, make sure required actions + * are implemented. + */ + if (!check_required_actions (introspection)) { + goto error; + } udn = gupnp_device_info_get_udn (device_info); if (G_UNLIKELY (udn == NULL)) @@ -126,10 +141,8 @@ get_introspection_cb (GUPnPServiceInfo *service_info, -1); g_free (name); - + g_object_unref (introspection); error: - /* We don't need the proxy objects anymore */ - g_object_unref (service_info); g_object_ref (device_info); } @@ -145,9 +158,10 @@ device_proxy_available_cb (GUPnPControlPoint *cp, return; } - gupnp_service_info_get_introspection_async (info, - get_introspection_cb, - g_object_ref (proxy)); + gupnp_service_info_introspect_async (info, + NULL, + get_introspection_cb, + g_object_ref (proxy)); } static void @@ -167,7 +181,7 @@ device_proxy_unavailable_cb (GUPnPControlPoint *cp, } static void -on_context_available (GUPnPContextManager *context_manager, +on_context_available (GUPnPContextManager *manager, GUPnPContext *context, gpointer user_data) { @@ -187,7 +201,7 @@ on_context_available (GUPnPContextManager *context_manager, gssdp_resource_browser_set_active (GSSDP_RESOURCE_BROWSER (cp), TRUE); /* Let context manager take care of the control point life cycle */ - gupnp_context_manager_manage_control_point (context_manager, cp); + gupnp_context_manager_manage_control_point (manager, cp); g_object_unref (cp); } @@ -198,19 +212,17 @@ init (NstPlugin *plugin) GtkCellRenderer *renderer; char *upload_cmd; +#ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +#endif /* ENABLE_NLS */ upload_cmd = g_find_program_in_path ("gupnp-upload"); if (upload_cmd == NULL) return FALSE; g_free (upload_cmd); -#ifdef HAS_GUPNP_VERSION_1_2 context_manager = gupnp_context_manager_create (0); -#else - context_manager = gupnp_context_manager_new (NULL, 0); -#endif g_assert (context_manager != NULL); g_signal_connect (context_manager, "context-available", G_CALLBACK (on_context_available), NULL); @@ -270,6 +282,7 @@ send_files (NstPlugin *plugin, g_ptr_array_add (argv, "15"); /* discovery timeout (seconds) */ g_ptr_array_add (argv, "-e"); g_ptr_array_add (argv, interface); + g_ptr_array_add (argv, "-u"); g_ptr_array_add (argv, udn); for (l = file_list ; l; l=l->next) { gchar *file_path; |