nautilus-sendto r392 - in trunk: . src src/plugins/balsa src/plugins/bluetooth src/plugins/empathy src/plugins/evolution src/plugins/gaim src/plugins/gajim src/plugins/nautilus-burn src/plugins/pidgin src/plugins/sylpheed-claws src/plugins/thunderbird src/plugins/upnp
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: nautilus-sendto r392 - in trunk: . src src/plugins/balsa src/plugins/bluetooth src/plugins/empathy src/plugins/evolution src/plugins/gaim src/plugins/gajim src/plugins/nautilus-burn src/plugins/pidgin src/plugins/sylpheed-claws src/plugins/thunderbird src/plugins/upnp
- Date: Fri, 6 Feb 2009 14:29:09 +0000 (UTC)
Author: hadess
Date: Fri Feb 6 14:29:08 2009
New Revision: 392
URL: http://svn.gnome.org/viewvc/nautilus-sendto?rev=392&view=rev
Log:
2009-02-06 Bastien Nocera <hadess hadess net>
* src/nautilus-sendto-plugin.h: Make it possible
for plugins to tell us whether they support sending
directories
* src/plugins/balsa/balsa.c (send_files):
* src/plugins/bluetooth/bluetooth.c:
* src/plugins/empathy/empathy.c:
* src/plugins/evolution/evolution.c:
* src/plugins/gaim/gaim.c:
* src/plugins/gajim/gajim.c:
* src/plugins/nautilus-burn/nautilus-burn.c:
* src/plugins/pidgin/pidgin.c:
* src/plugins/sylpheed-claws/sylpheed-claws.c:
* src/plugins/thunderbird/thunderbird.c:
* src/plugins/upnp/upnp.c: Update for the above
* src/nautilus-sendto-command.c (send_button_cb),
(send_if_no_pack_cb), (option_changed), (set_contact_widgets),
(set_model_for_options_combobox), (pack_entry_changed_cb),
(nautilus_sendto_create_ui), (nautilus_sendto_init):
Don't automatically force packing directories into archives,
as some plugins support being given directories
(Closes: #568423)
Also fix a few warnings in the balsa plugin, don't make the
bluetooth plugin unloadable anymore, kill useless --default-dir
command-line option
Modified:
trunk/ChangeLog
trunk/src/nautilus-sendto-command.c
trunk/src/nautilus-sendto-plugin.h
trunk/src/plugins/balsa/balsa.c
trunk/src/plugins/bluetooth/bluetooth.c
trunk/src/plugins/empathy/empathy.c
trunk/src/plugins/evolution/evolution.c
trunk/src/plugins/gaim/gaim.c
trunk/src/plugins/gajim/gajim.c
trunk/src/plugins/nautilus-burn/nautilus-burn.c
trunk/src/plugins/pidgin/pidgin.c
trunk/src/plugins/sylpheed-claws/sylpheed-claws.c
trunk/src/plugins/thunderbird/thunderbird.c
trunk/src/plugins/upnp/upnp.c
Modified: trunk/src/nautilus-sendto-command.c
==============================================================================
--- trunk/src/nautilus-sendto-command.c (original)
+++ trunk/src/nautilus-sendto-command.c Fri Feb 6 14:29:08 2009
@@ -22,13 +22,12 @@
*/
#include "config.h"
-#include <sys/types.h>
-#include <dirent.h>
#include <string.h>
#include <stdlib.h>
#include <glib/gi18n.h>
#include <glib/gstdio.h>
#include <glade/glade.h>
+#include <gtk/gtk.h>
#include <gconf/gconf-client.h>
#include "nautilus-sendto-plugin.h"
@@ -41,11 +40,10 @@
#define UNINSTALLED_SOURCE "nautilus-sendto-command.c"
/* Options */
-static gchar *default_url = NULL;
static char **filenames = NULL;
-gboolean force_user_to_compress = FALSE;
GList *file_list = NULL;
+gboolean has_dirs = FALSE;
GList *plugin_list = NULL;
GHashTable *hash ;
guint option = 0;
@@ -73,7 +71,6 @@
};
static const GOptionEntry entries[] = {
- { "default-dir", 'd', 0, G_OPTION_ARG_FILENAME, &default_url, N_("Default folder to use"), NULL },
{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, &filenames, "Movies to index", NULL },
{ NULL }
};
@@ -258,10 +255,9 @@
}
static void
-send_button_cb (GtkWidget *widget, gpointer data)
+send_button_cb (GtkWidget *widget, NS_ui *ui)
{
- NS_ui *ui = (NS_ui *) data;
- gchar *f, *error;
+ char *f, *error;
NstPlugin *p;
GtkWidget *w;
@@ -300,7 +296,7 @@
gconf_client_set_string (gconf_client,
NAUTILUS_SENDTO_LAST_MEDIUM, p->info->id, NULL);
- if (force_user_to_compress){
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ui->pack_checkbutton))){
f = pack_files (ui);
if (f != NULL) {
GList *packed_file = NULL;
@@ -314,48 +310,30 @@
gtk_widget_set_sensitive (ui->dialog, TRUE);
return;
}
- }else{
- if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ui->pack_checkbutton))){
- f = pack_files (ui);
- if (f != NULL) {
- GList *packed_file = NULL;
- packed_file = g_list_append (packed_file, f);
- if (!p->info->send_files (p, w, packed_file)) {
- g_list_free (packed_file);
- return;
- }
- g_list_free (packed_file);
- } else {
- gtk_widget_set_sensitive (ui->dialog, TRUE);
- return;
- }
- } else {
- if (!p->info->send_files (p, w, file_list)) {
- g_list_foreach (file_list, (GFunc) g_free, NULL);
- g_list_free (file_list);
- file_list = NULL;
- return;
- }
+ } else {
+ if (!p->info->send_files (p, w, file_list)) {
+ g_list_foreach (file_list, (GFunc) g_free, NULL);
g_list_free (file_list);
file_list = NULL;
+ return;
}
+ g_list_free (file_list);
+ file_list = NULL;
}
destroy_dialog (NULL,NULL);
}
static void
-send_if_no_pack_cb (GtkWidget *widget, gpointer data)
+send_if_no_pack_cb (GtkWidget *widget, NS_ui *ui)
{
- NS_ui *ui = (NS_ui *) data;
-
- if (force_user_to_compress || gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
- if (force_user_to_compress) {
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton))) {
+ if (GTK_WIDGET_IS_SENSITIVE (ui->pack_entry)) {
gtk_widget_grab_focus (ui->pack_entry);
} else {
gtk_widget_grab_focus (ui->pack_checkbutton);
}
} else {
- send_button_cb (widget, data);
+ send_button_cb (widget, ui);
}
}
@@ -383,9 +361,11 @@
}
static void
-option_changed (GtkComboBox *cb, gpointer data){
- NS_ui *ui = (NS_ui *) data ;
- GList *aux;
+option_changed (GtkComboBox *cb, NS_ui *ui)
+{
+ GList *aux;
+ NstPlugin *p;
+ gboolean supports_dirs = FALSE;
aux = g_list_nth (ui->contact_widgets, option);
option = gtk_combo_box_get_active (GTK_COMBO_BOX(cb));
@@ -394,10 +374,26 @@
gtk_widget_show ((GtkWidget *) aux->data);
gtk_label_set_mnemonic_widget (GTK_LABEL (ui->send_to_label), aux->data);
+
+ p = (NstPlugin *) g_list_nth_data (plugin_list, option);
+ supports_dirs = p->info->can_send_directories;
+
+ if (has_dirs == FALSE || supports_dirs != FALSE) {
+ gboolean toggle;
+
+ toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
+ gtk_widget_set_sensitive (ui->pack_combobox, toggle);
+ gtk_widget_set_sensitive (ui->pack_entry, toggle);
+ gtk_widget_set_sensitive (ui->pack_checkbutton, TRUE);
+ } else {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
+ gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
+ }
}
static void
-set_contact_widgets (NS_ui *ui){
+set_contact_widgets (NS_ui *ui)
+{
GList *aux ;
GtkWidget *w;
NstPlugin *p;
@@ -417,8 +413,9 @@
}
}
-static void
-set_model_for_options_combobox (NS_ui *ui){
+static gboolean
+set_model_for_options_combobox (NS_ui *ui)
+{
GdkPixbuf *pixbuf;
GtkTreeIter iter;
GtkTreeStore *model;
@@ -426,8 +423,9 @@
GtkCellRenderer *renderer;
GList *aux;
NstPlugin *p;
- gchar *last_used = NULL;
+ char *last_used = NULL;
int i = 0;
+ gboolean last_used_support_dirs = FALSE;
it = gtk_icon_theme_get_default ();
@@ -436,7 +434,7 @@
last_used = gconf_client_get_string (gconf_client,
NAUTILUS_SENDTO_LAST_MEDIUM, NULL);
- for (aux = plugin_list; aux; aux = aux->next){
+ for (aux = plugin_list; aux; aux = aux->next) {
p = (NstPlugin *) aux->data;
pixbuf = gtk_icon_theme_load_icon (it, p->info->icon, 16,
GTK_ICON_LOOKUP_USE_BUILTIN, NULL);
@@ -445,8 +443,10 @@
0, pixbuf,
1, p->info->description,
-1);
- if (last_used != NULL && !strcmp(last_used, p->info->id))
+ if (last_used != NULL && !strcmp(last_used, p->info->id)) {
option = i;
+ last_used_support_dirs = p->info->can_send_directories;
+ }
i++;
}
g_free(last_used);
@@ -474,12 +474,12 @@
G_CALLBACK (option_changed), ui);
gtk_combo_box_set_active (GTK_COMBO_BOX (ui->options_combobox), option);
+
+ return last_used_support_dirs;
}
static void
-pack_entry_changed_cb (GObject *object,
- GParamSpec *spec,
- NS_ui *ui)
+pack_entry_changed_cb (GObject *object, GParamSpec *spec, NS_ui *ui)
{
gboolean send_enabled;
@@ -500,9 +500,9 @@
nautilus_sendto_create_ui (void)
{
GladeXML *app;
- gint toggle;
NS_ui *ui;
gboolean one_file = FALSE;
+ gboolean supports_dirs;
app = glade_xml_new (GLADEDIR "/" "nautilus-sendto.glade", NULL, NULL);
@@ -524,7 +524,6 @@
gtk_combo_box_set_active (GTK_COMBO_BOX(ui->pack_combobox),
gconf_client_get_int(gconf_client,
NAUTILUS_SENDTO_LAST_COMPRESS, NULL));
-
if (file_list != NULL && file_list->next != NULL)
one_file = FALSE;
@@ -536,7 +535,7 @@
if (one_file) {
char *filepath = NULL, *filename = NULL;
- filepath = g_filename_from_uri ((gchar *)file_list->data,
+ filepath = g_filename_from_uri ((char *)file_list->data,
NULL, NULL);
if (filepath != NULL)
@@ -556,7 +555,7 @@
}
set_contact_widgets (ui);
- set_model_for_options_combobox (ui);
+ supports_dirs = set_model_for_options_combobox (ui);
g_signal_connect (G_OBJECT (ui->dialog), "destroy",
G_CALLBACK (destroy_dialog), NULL);
g_signal_connect (G_OBJECT (ui->cancel_button), "clicked",
@@ -567,13 +566,15 @@
G_CALLBACK (send_button_cb), ui);
g_signal_connect (G_OBJECT (ui->pack_entry), "notify::text",
G_CALLBACK (pack_entry_changed_cb), ui);
+ g_signal_connect (G_OBJECT (ui->pack_checkbutton), "toggled",
+ G_CALLBACK (toggle_pack_check), ui);
+
+ if (has_dirs == FALSE || supports_dirs != FALSE) {
+ gboolean toggle;
- if (force_user_to_compress == FALSE){
toggle = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton));
gtk_widget_set_sensitive (ui->pack_combobox, toggle);
gtk_widget_set_sensitive (ui->pack_entry, toggle);
- g_signal_connect (G_OBJECT (ui->pack_checkbutton), "toggled",
- G_CALLBACK (toggle_pack_check), ui);
} else {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (ui->pack_checkbutton), TRUE);
gtk_widget_set_sensitive (ui->pack_checkbutton, FALSE);
@@ -708,10 +709,6 @@
if (g_module_supported() == FALSE)
g_error ("Could not initialize gmodule support");
- if (default_url == NULL) {
- default_url = g_get_current_dir ();
- }
-
for (i = 0; filenames != NULL && filenames[i] != NULL; i++) {
GFile *file;
char *filename, *escaped, *uri;
@@ -722,7 +719,7 @@
continue;
if (g_file_test (filename, G_FILE_TEST_IS_DIR) != FALSE)
- force_user_to_compress = TRUE;
+ has_dirs = TRUE;
uri = g_filename_to_uri (filename, NULL, NULL);
g_free (filename);
Modified: trunk/src/nautilus-sendto-plugin.h
==============================================================================
--- trunk/src/nautilus-sendto-plugin.h (original)
+++ trunk/src/nautilus-sendto-plugin.h Fri Feb 6 14:29:08 2009
@@ -36,6 +36,7 @@
gchar *id;
gchar *description;
gboolean never_unload;
+ gboolean can_send_directories;
gboolean (*init)(NstPlugin *plugin);
GtkWidget* (*get_contacts_widget)(NstPlugin *plugin);
gboolean (*validate_destination)(NstPlugin *plugin, GtkWidget *contact_widget, char **error);
Modified: trunk/src/plugins/balsa/balsa.c
==============================================================================
--- trunk/src/plugins/balsa/balsa.c (original)
+++ trunk/src/plugins/balsa/balsa.c Fri Feb 6 14:29:08 2009
@@ -58,10 +58,9 @@
gboolean send_files (NstPlugin *plugin, GtkWidget *contact_widget,
GList *file_list)
{
- gchar *b_cmd, *cmd, *send_to, *send_to_info ;
+ gchar *b_cmd, *cmd, *send_to;
GList *l;
GString *mailto;
- GtkWidget *error_dialog;
send_to = (gchar *) gtk_entry_get_text (GTK_ENTRY(contact_widget));
@@ -79,9 +78,9 @@
if (b_cmd == NULL)
return FALSE;
- g_string_append_printf (mailto," attach=\"%s\"",file_list->data);
+ g_string_append_printf (mailto," attach=\"%s\"", (char *) file_list->data);
for (l = file_list->next ; l; l=l->next){
- g_string_append_printf (mailto," \"%s\"",l->data);
+ g_string_append_printf (mailto," \"%s\"", (char *) l->data);
}
cmd = g_strdup_printf ("%s %s", b_cmd, mailto->str);
g_spawn_command_line_async (cmd, NULL);
@@ -102,6 +101,7 @@
"balsa",
N_("Email (Balsa)"),
FALSE,
+ FALSE,
init,
get_contacts_widget,
NULL,
Modified: trunk/src/plugins/bluetooth/bluetooth.c
==============================================================================
--- trunk/src/plugins/bluetooth/bluetooth.c (original)
+++ trunk/src/plugins/bluetooth/bluetooth.c Fri Feb 6 14:29:08 2009
@@ -522,7 +522,8 @@
"bluetooth",
"bluetooth",
N_("Bluetooth (OBEX Push)"),
- TRUE,
+ FALSE,
+ FALSE,
init,
get_contacts_widget,
validate_destination,
Modified: trunk/src/plugins/empathy/empathy.c
==============================================================================
--- trunk/src/plugins/empathy/empathy.c (original)
+++ trunk/src/plugins/empathy/empathy.c Fri Feb 6 14:29:08 2009
@@ -186,6 +186,7 @@
"empathy",
N_("Instant Message (Empathy)"),
TRUE,
+ FALSE,
init,
get_contacts_widget,
validate_destination,
Modified: trunk/src/plugins/evolution/evolution.c
==============================================================================
--- trunk/src/plugins/evolution/evolution.c (original)
+++ trunk/src/plugins/evolution/evolution.c Fri Feb 6 14:29:08 2009
@@ -220,6 +220,7 @@
"evolution",
N_("Email (Evolution)"),
FALSE,
+ FALSE,
init,
get_contacts_widget,
NULL,
Modified: trunk/src/plugins/gaim/gaim.c
==============================================================================
--- trunk/src/plugins/gaim/gaim.c (original)
+++ trunk/src/plugins/gaim/gaim.c Fri Feb 6 14:29:08 2009
@@ -227,6 +227,7 @@
"gaim",
N_("Instant Message (Gaim)"),
FALSE,
+ FALSE,
init,
get_contacts_widget,
NULL,
Modified: trunk/src/plugins/gajim/gajim.c
==============================================================================
--- trunk/src/plugins/gajim/gajim.c (original)
+++ trunk/src/plugins/gajim/gajim.c Fri Feb 6 14:29:08 2009
@@ -487,6 +487,7 @@
"gajim",
N_("Instant Message (Gajim)"),
TRUE,
+ FALSE,
init,
get_contacts_widget,
NULL,
Modified: trunk/src/plugins/nautilus-burn/nautilus-burn.c
==============================================================================
--- trunk/src/plugins/nautilus-burn/nautilus-burn.c (original)
+++ trunk/src/plugins/nautilus-burn/nautilus-burn.c Fri Feb 6 14:29:08 2009
@@ -182,6 +182,7 @@
"nautilus-burn",
N_("CD/DVD Creator"),
FALSE,
+ TRUE,
init,
get_contacts_widget,
NULL,
Modified: trunk/src/plugins/pidgin/pidgin.c
==============================================================================
--- trunk/src/plugins/pidgin/pidgin.c (original)
+++ trunk/src/plugins/pidgin/pidgin.c Fri Feb 6 14:29:08 2009
@@ -349,6 +349,7 @@
"pidgin",
N_("Instant Message (Pidgin)"),
FALSE,
+ FALSE,
init,
get_contacts_widget,
NULL,
Modified: trunk/src/plugins/sylpheed-claws/sylpheed-claws.c
==============================================================================
--- trunk/src/plugins/sylpheed-claws/sylpheed-claws.c (original)
+++ trunk/src/plugins/sylpheed-claws/sylpheed-claws.c Fri Feb 6 14:29:08 2009
@@ -130,6 +130,7 @@
"sylpheed-claws",
N_("Email (Claws Mail)"),
FALSE,
+ FALSE,
init,
get_contacts_widget,
NULL,
Modified: trunk/src/plugins/thunderbird/thunderbird.c
==============================================================================
--- trunk/src/plugins/thunderbird/thunderbird.c (original)
+++ trunk/src/plugins/thunderbird/thunderbird.c Fri Feb 6 14:29:08 2009
@@ -104,6 +104,7 @@
"thunderbird",
N_("Email (Thunderbird)"),
FALSE,
+ FALSE,
init,
get_contacts_widget,
NULL,
Modified: trunk/src/plugins/upnp/upnp.c
==============================================================================
--- trunk/src/plugins/upnp/upnp.c (original)
+++ trunk/src/plugins/upnp/upnp.c Fri Feb 6 14:29:08 2009
@@ -297,6 +297,7 @@
"upnp",
N_("UPnP Media Server"),
FALSE,
+ FALSE,
init,
get_contacts_widget,
NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]