Commit 53ac46c8 authored by madmurphy's avatar madmurphy
Browse files

Commit #5

parent c58fa43a
......@@ -2,6 +2,14 @@ Change Log
==========
0.1.2
-----
Changes:
* Code review
0.1.1
-----
......@@ -14,3 +22,4 @@ Changes:
-----
**nautilus-bluetooth** has been published.
......@@ -12,3 +12,4 @@ NEWS
-----
**nautilus-bluetooth** has been published.
nautilus-bluetooth
==================
A simple Nautilus extension written in C that adds a “Send via Bluetooth” entry to Nautilus’ right-click menu.
A simple Nautilus extension written in C that adds a Send via Bluetooth entry
to Nautilus' right-click menu.
Get involved
------------
The package needs help with internationalization. If a translation into your language is missing and you wish to get involved, here is what to do.
The package needs help with internationalization. If a translation into your
language is missing and you wish to get involved, here is what to do.
Let's say you want to create a Dutch translation of **nautilus-bluetooth**. The package comes with only two strings to translate:
Let's say you want to create a Dutch translation of **nautilus-bluetooth**. This
package comes with only two strings to translate:
1. Send via Bluetooth
2. Send the selected files to a Bluetooth device
First thing to do is to make sure that `gettext` is installed in your system. Then clone this repository and launch the following two commands:
First thing to do is to make sure that `gettext` is installed in your system.
Then clone this repository and launch the following two commands:
```
cd nautilus-bluetooth/po
msginit -l nl
```
Enter your email address and press enter. Now edit the `po/LINGUAS` file and add a new line containing the abbreviated name of the new language (`nl`).
Enter your email address and press enter. Now edit the `po/LINGUAS` file and add
a new line containing the abbreviated name of the new language (`nl`).
Finally, open the file `po/nl.po` and translate the two strings above. All you have to do now is to commit your changes.
Finally, open the file `po/nl.po` and translate the two strings above. All you
have to do now is to commit your changes.
For any issue, [drop me a message][1].
[1]: https://github.com/madmurphy/nautilus-bluetooth/issues
......@@ -6,18 +6,18 @@ dnl A U T O C O N F E N V I R O N M E N T
dnl ***************************************************************************
AC_INIT([nautilus-bluetooth], [0.1])
AC_PREREQ([2.69])
AC_CONFIG_HEADERS([config.h])
AC_INIT([nautilus-bluetooth], [0.1])
AM_INIT_AUTOMAKE([1.11])
AM_SILENT_RULES([yes])
AC_PREREQ([2.69])
AC_CONFIG_SRCDIR([src/nautilus-bluetooth.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_FILES([Makefile
......@@ -30,12 +30,6 @@ AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_FUNC_FORK
AC_TYPE_PID_T
AC_TYPE_SIZE_T
PKG_CHECK_MODULES([NAUTILUS_BLUETOOTH], [glib-2.0 libnautilus-extension])
AC_CHECK_PROG([HAVE_PKGCONFIG], [pkg-config], [yes], [no])
......@@ -53,7 +47,7 @@ dnl BLUETOOTH_SENDTO argument variable
AC_DEFUN([DEFAULT_BLUETOOTH_SENDTO_PROG], [bluetooth-sendto])
dnl Register the BLUETOOTH_SENDTO argument variable...
AC_ARG_VAR([BLUETOOTH_SENDTO], [Bluetooth file sharing command; it must support the syntax BLUETOOTH_SENDTO file1 file2 file3 ... etc. @<:@default=/usr/bin/]DEFAULT_BLUETOOTH_SENDTO_PROG[@:>@])
AC_ARG_VAR([BLUETOOTH_SENDTO], [Bluetooth file sharing command; it must support the syntax BLUETOOTH_SENDTO file1 file2 file3 ... etc. @<:@default=BINDIR/]DEFAULT_BLUETOOTH_SENDTO_PROG[@:>@])
dnl First check whether a BLUETOOTH_SENDTO argument variable has been given; if
dnl not, check whether DEFAULT_BLUETOOTH_SENDTO_PROG is present in the system;
......
{
"name": "nautilus-bluetooth",
"version": "0.1.1",
"version": "0.1.2",
"description": "A simple Nautilus extension that adds a \"Send via Bluetooth\" entry to Nautilus' right-click menu",
"homepage": "https://github.com/madmurphy/nautilus-bluetooth",
"author": "madmurphy333@gmail.com",
......
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-01 14:57+0100\n"
"POT-Creation-Date: 2019-09-02 15:05+0100\n"
"PO-Revision-Date: 2019-09-01 00:19+0200\n"
"Last-Translator: Jannis Schmidt <jschmidt@posteo.de>\n"
"Language-Team: German <translation-team-de@lists.sourceforge.net>\n"
......@@ -17,10 +17,10 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../src/nautilus-bluetooth.c:154
#: ../src/nautilus-bluetooth.c:133
msgid "Send via Bluetooth"
msgstr "Via Bluetooth senden"
#: ../src/nautilus-bluetooth.c:155
#: ../src/nautilus-bluetooth.c:134
msgid "Send the selected files to a Bluetooth device"
msgstr "Versende die ausgewählten Dateien an ein Bluetooth-Gerät"
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-01 14:57+0100\n"
"POT-Creation-Date: 2019-09-02 15:05+0100\n"
"PO-Revision-Date: 2019-08-28 13:59+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Spanish <es@tp.org.es>\n"
......@@ -17,10 +17,10 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../src/nautilus-bluetooth.c:154
#: ../src/nautilus-bluetooth.c:133
msgid "Send via Bluetooth"
msgstr "Enviar por Bluetooth"
#: ../src/nautilus-bluetooth.c:155
#: ../src/nautilus-bluetooth.c:134
msgid "Send the selected files to a Bluetooth device"
msgstr "Enviar los archivos seleccionados a un dispositivo Bluetooth"
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-01 14:57+0100\n"
"POT-Creation-Date: 2019-09-02 15:05+0100\n"
"PO-Revision-Date: 2019-08-28 13:59+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: French <traduc@traduc.org>\n"
......@@ -17,10 +17,10 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: ../src/nautilus-bluetooth.c:154
#: ../src/nautilus-bluetooth.c:133
msgid "Send via Bluetooth"
msgstr "Envoyer via Bluetooth"
#: ../src/nautilus-bluetooth.c:155
#: ../src/nautilus-bluetooth.c:134
msgid "Send the selected files to a Bluetooth device"
msgstr "Envoyer les fichiers sélectionnés à un périphérique Bluetooth"
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-01 14:57+0100\n"
"POT-Creation-Date: 2019-09-02 15:05+0100\n"
"PO-Revision-Date: 2019-08-26 17:05+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Italian <tp@lists.linux.it>\n"
......@@ -17,10 +17,10 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../src/nautilus-bluetooth.c:154
#: ../src/nautilus-bluetooth.c:133
msgid "Send via Bluetooth"
msgstr "Invia tramite Bluetooth"
#: ../src/nautilus-bluetooth.c:155
#: ../src/nautilus-bluetooth.c:134
msgid "Send the selected files to a Bluetooth device"
msgstr "Invia i file selezionati a un dispositivo Bluetooth"
......@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-01 14:57+0100\n"
"POT-Creation-Date: 2019-09-02 15:05+0100\n"
"PO-Revision-Date: 2019-08-28 02:30+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Latin\n"
......@@ -16,10 +16,10 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../src/nautilus-bluetooth.c:154
#: ../src/nautilus-bluetooth.c:133
msgid "Send via Bluetooth"
msgstr "Mitte per Bluetooth"
#: ../src/nautilus-bluetooth.c:155
#: ../src/nautilus-bluetooth.c:134
msgid "Send the selected files to a Bluetooth device"
msgstr "Mitte electos codicillos ad Bluetooth apparatum"
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-09-01 16:52+0100\n"
"POT-Creation-Date: 2019-09-02 15:05+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -17,10 +17,10 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../src/nautilus-bluetooth.c:154
#: ../src/nautilus-bluetooth.c:133
msgid "Send via Bluetooth"
msgstr ""
#: ../src/nautilus-bluetooth.c:155
#: ../src/nautilus-bluetooth.c:134
msgid "Send the selected files to a Bluetooth device"
msgstr ""
......@@ -36,15 +36,11 @@
/*
GLOBAL VARIABLES
GLOBAL TYPES AND VARIABLES
*/
static GType provider_types[1];
static GType nautilus_bluetooth_type;
static GObjectClass * parent_class;
typedef struct {
GObject parent_slot;
} NautilusBluetooth;
......@@ -53,6 +49,10 @@ typedef struct {
GObjectClass parent_slot;
} NautilusBluetoothClass;
static GType provider_types[1];
static GType nautilus_bluetooth_type;
static GObjectClass * parent_class;
/*
......@@ -67,50 +67,31 @@ static void nautilus_bluetooth_sendto (
gpointer user_data
) {
GList * file_selection, * iter;
file_selection = g_object_get_data((GObject *) menu_item, "nautilus_bluetooth_files");
const guint argv_last = g_list_length(file_selection) + 1;
char ** argv = g_malloc((argv_last + 1) * sizeof(char *));
size_t idx = 1;
GList * file_selection = g_object_get_data((GObject *) menu_item, "nautilus_bluetooth_files");
const gsize argv_last = g_list_length(file_selection) + 1;
gchar ** argv = g_malloc((argv_last + 1) * sizeof(gchar *));
gsize idx = 1;
GError * spawnerr = NULL;
*argv = NAUTILUS_BLUETOOTH_SENDTO_CMD;
argv[argv_last] = NULL;
for (iter = file_selection; iter; iter = iter->next) {
for (GList * iter = file_selection; iter; iter = iter->next) {
argv[idx++] = nautilus_file_info_get_uri(NAUTILUS_FILE_INFO(iter->data));
}
const pid_t proc_id = fork();
if (proc_id < 0) {
perror("fork");
} else if (proc_id > 0) {
if (!g_spawn_async(NULL, argv, NULL, 0, NULL, NULL, NULL, &spawnerr)) {
/* Parent */
fprintf(stderr, "%s\n", spawnerr->message);
g_error_free(spawnerr);
for (idx = 1; idx < argv_last; g_free(argv[idx++]));
g_free(argv);
} else {
/* Child */
if (execv(*argv, argv) == -1) {
perror("execv");
}
}
_exit(1);
for (idx = 1; idx < argv_last; g_free(argv[idx++]));
}
g_free(argv);
}
......@@ -135,9 +116,7 @@ static GList * nautilus_bluetooth_get_file_items (
GList * file_selection
) {
GList * iter;
for (iter = file_selection; iter; iter = iter->next) {
for (GList * iter = file_selection; iter; iter = iter->next) {
/* Avoid directories */
......@@ -150,7 +129,7 @@ static GList * nautilus_bluetooth_get_file_items (
}
NautilusMenuItem * menu_item = nautilus_menu_item_new(
"NautilusBluetooth::sendto_bluetooth",
"NautilusBluetooth::send_to_bluetooth",
_("Send via Bluetooth"),
_("Send the selected files to a Bluetooth device"),
"bluetooth"
......@@ -200,7 +179,7 @@ static void nautilus_bluetooth_register_type (GTypeModule * module) {
static const GInterfaceInfo menu_provider_iface_info = {
(GInterfaceInitFunc) nautilus_bluetooth_menu_provider_iface_init,
NULL,
(GInterfaceFinalizeFunc) NULL,
NULL
};
......@@ -222,12 +201,10 @@ static void nautilus_bluetooth_register_type (GTypeModule * module) {
}
void nautilus_module_initialize (GTypeModule * module) {
void nautilus_module_initialize (GTypeModule * module) {
#ifdef ENABLE_NLS
bindtextdomain(GETTEXT_PACKAGE, NAUTILUS_BLUETOOTH_LOCALEDIR);
#endif
nautilus_bluetooth_register_type(module);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment