diff options
Diffstat (limited to 'sendto')
-rw-r--r-- | sendto/Makefile.am | 4 | ||||
-rw-r--r-- | sendto/caja-nste.c | 14 | ||||
-rw-r--r-- | sendto/caja-sendto-command.c | 33 | ||||
-rw-r--r-- | sendto/caja-sendto-module.c | 18 | ||||
-rw-r--r-- | sendto/docs/Makefile.am | 2 | ||||
-rw-r--r-- | sendto/libcaja-sendto.caja-extension.desktop.in.in | 4 | ||||
-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 |
12 files changed, 123 insertions, 78 deletions
diff --git a/sendto/Makefile.am b/sendto/Makefile.am index c964773..a1e9bb0 100644 --- a/sendto/Makefile.am +++ b/sendto/Makefile.am @@ -83,7 +83,11 @@ extensiondir = $(datadir)/caja/extensions extension_in_files = libcaja-sendto.caja-extension.desktop.in extension_DATA = $(extension_in_files:.caja-extension.desktop.in=.caja-extension) $(extension_DATA): $(extension_in_files) +if USE_NLS $(AM_V_GEN) $(MSGFMT) --desktop --keyword= --keyword=Copyright --keyword=Name --keyword=Description --template $< -d $(top_srcdir)/po -o $@ +else + $(AM_V_GEN) cp $< $@ +endif EXTRA_DIST = \ $(man_MANS) \ diff --git a/sendto/caja-nste.c b/sendto/caja-nste.c index a59ae56..429b368 100644 --- a/sendto/caja-nste.c +++ b/sendto/caja-nste.c @@ -21,15 +21,18 @@ * */ +#ifdef HAVE_CONFIG_H #include <config.h> -#include <string.h> +#endif + #include <glib/gi18n-lib.h> + +#include <string.h> #include <libcaja-extension/caja-extension-types.h> #include <libcaja-extension/caja-file-info.h> #include <libcaja-extension/caja-menu-provider.h> #include "caja-nste.h" - static GObjectClass *parent_class; static void @@ -96,37 +99,31 @@ caja_nste_get_file_items (CajaMenuProvider *provider, return items; } - static void caja_nste_menu_provider_iface_init (CajaMenuProviderIface *iface) { iface->get_file_items = caja_nste_get_file_items; } - static void caja_nste_instance_init (CajaNste *nste) { } - static void caja_nste_class_init (CajaNsteClass *class) { parent_class = g_type_class_peek_parent (class); } - static GType nste_type = 0; - GType caja_nste_get_type (void) { return nste_type; } - void caja_nste_register_type (GTypeModule *module) { @@ -140,6 +137,7 @@ caja_nste_register_type (GTypeModule *module) sizeof (CajaNste), 0, (GInstanceInitFunc) caja_nste_instance_init, + NULL }; static const GInterfaceInfo menu_provider_iface_info = { diff --git a/sendto/caja-sendto-command.c b/sendto/caja-sendto-command.c index f1f7397..8181db6 100644 --- a/sendto/caja-sendto-command.c +++ b/sendto/caja-sendto-command.c @@ -21,9 +21,13 @@ * Author: Roberto Majadas <[email protected]> */ -#include "config.h" +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include <string.h> #include <stdlib.h> +#include <glib.h> #include <glib/gi18n.h> #include <glib/gstdio.h> #include <gtk/gtk.h> @@ -34,10 +38,8 @@ #define CAJA_SENDTO_STATUS_LABEL_TIMEOUT_SECONDS 10 #define UNINSTALLED_PLUGINDIR "plugins/removable-devices" -#define UNINSTALLED_SOURCE "caja-sendto-command.c" #define SOEXT ("." G_MODULE_SUFFIX) -#define SOEXT_LEN (strlen (SOEXT)) enum { COLUMN_ICON, @@ -78,7 +80,7 @@ struct _NS_ui { static const GOptionEntry entries[] = { { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, "Files to send", "[FILES...]" }, - { NULL } + { NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL } }; static void @@ -315,8 +317,7 @@ send_button_cb (GtkWidget *widget, NS_ui *ui) g_free (f); } else { if (!p->info->send_files (p, w, file_list)) { - g_list_foreach (file_list, (GFunc) g_free, NULL); - g_list_free (file_list); + g_list_free_full (file_list, g_free); file_list = NULL; return; } @@ -444,9 +445,13 @@ set_model_for_options_combobox (NS_ui *ui) GTK_ICON_LOOKUP_USE_BUILTIN, NULL); gtk_list_store_append (model, &iter); gtk_list_store_set (model, &iter, - COLUMN_ICON, pixbuf, - COLUMN_DESCRIPTION, dgettext(p->info->gettext_package, p->info->description), - -1); + COLUMN_ICON, pixbuf, +#ifdef ENABLE_NLS + COLUMN_DESCRIPTION, g_dgettext (p->info->gettext_package, p->info->description), +#else + COLUMN_DESCRIPTION, p->info->description, +#endif /* ENABLE_NLS */ + -1); if (last_used != NULL && !strcmp(last_used, p->info->id)) { option = i; last_used_support_dirs = (p->info->capabilities & CAJA_CAPS_SEND_DIRECTORIES); @@ -506,13 +511,13 @@ pack_entry_changed_cb (GObject *object, GParamSpec *spec, NS_ui *ui) } static void -update_button_image (GtkSettings *settings, - GParamSpec *spec, - GtkWidget *widget) +update_button_image (GtkSettings *gtk_settings, + GParamSpec *spec, + GtkWidget *widget) { gboolean show_images; - g_object_get (settings, "gtk-button-images", &show_images, NULL); + g_object_get (gtk_settings, "gtk-button-images", &show_images, NULL); if (show_images == FALSE) gtk_widget_hide (widget); else @@ -798,9 +803,11 @@ int main (int argc, char **argv) GOptionContext *context; GError *error = NULL; +#ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); +#endif /* ENABLE_NLS */ context = g_option_context_new (""); g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); diff --git a/sendto/caja-sendto-module.c b/sendto/caja-sendto-module.c index cfb4737..dc453ae 100644 --- a/sendto/caja-sendto-module.c +++ b/sendto/caja-sendto-module.c @@ -21,29 +21,34 @@ * */ +#ifdef HAVE_CONFIG_H #include <config.h> +#endif + +#include <glib/gi18n-lib.h> + #include <libcaja-extension/caja-extension-types.h> #include <libcaja-extension/caja-column-provider.h> -#include <glib/gi18n-lib.h> -#include "caja-nste.h" +#include "caja-nste.h" void caja_module_initialize (GTypeModule*module) { + g_print ("Initializing caja-sendto extension\n"); caja_nste_register_type (module); - +#ifdef ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, MATELOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); +#endif /* ENABLE_NLS */ } - void caja_module_shutdown (void) { + g_print ("Shutting down caja-sendto extension\n"); } - void caja_module_list_types (const GType **types, int *num_types) @@ -55,6 +60,3 @@ caja_module_list_types (const GType **types, *num_types = 1; } - - - diff --git a/sendto/docs/Makefile.am b/sendto/docs/Makefile.am index 20f6768..3b293be 100644 --- a/sendto/docs/Makefile.am +++ b/sendto/docs/Makefile.am @@ -80,6 +80,8 @@ GTKDOC_LIBS=$(top_builddir)/sendto/libnstplugin.la # This includes the standard gtk-doc make rules, copied by gtkdocize. include $(top_srcdir)/gtk-doc.make +DISTCLEANFILES = $(DOC_MODULE).actions + # Other files to distribute # e.g. EXTRA_DIST += version.xml.in EXTRA_DIST += version.xml.in diff --git a/sendto/libcaja-sendto.caja-extension.desktop.in.in b/sendto/libcaja-sendto.caja-extension.desktop.in.in index d43bdab..aa3c7b3 100644 --- a/sendto/libcaja-sendto.caja-extension.desktop.in.in +++ b/sendto/libcaja-sendto.caja-extension.desktop.in.in @@ -4,6 +4,6 @@ Icon=mail-send Name=Send To Description=Integrates email clients and Pidgin Author=Roberto Majadas <[email protected]> -Copyright=Copyright (C) 2004 Roberto Majadas +Copyright=Copyright (C) 2004 Roberto Majadas\nCopyright (C) 2013-2014 Stefano Karapetsas\nCopyright (C) 2015-2021 MATE developers Version=@VERSION@ -Website=https://mate-desktop.org/ +Website=@PACKAGE_URL@ 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; |