gnome-user-share r201 - trunk
- From: hadess svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-user-share r201 - trunk
- Date: Thu, 21 Feb 2008 23:35:28 +0000 (GMT)
Author: hadess
Date: Thu Feb 21 23:35:28 2008
New Revision: 201
URL: http://svn.gnome.org/viewvc/gnome-user-share?rev=201&view=rev
Log:
2008-02-21 Bastien Nocera <hadess hadess net>
* Makefile.am:
* desktop_gnome_file_sharing.schemas.in:
* file-share-properties.c (password_string_from_setting),
(update_ui), (file_sharing_bluetooth_require_pairing_changed),
(launch_share), (main):
* file-share-properties.glade:
* http.c (get_share_name):
* obexftp.c (obexftp_up):
* user_share-private.h:
* user_share.c (lookup_download_dir),
(file_sharing_bluetooth_require_pairing_changed), (main):
* user_share.h:
Add support for the new "Require pairing" from obex-data-server
0.2, update API usage for 0.3
Added:
trunk/user_share-private.h
Modified:
trunk/ChangeLog
trunk/Makefile.am
trunk/desktop_gnome_file_sharing.schemas.in
trunk/file-share-properties.c
trunk/file-share-properties.glade
trunk/http.c
trunk/obexftp.c
trunk/user_share.c
trunk/user_share.h
Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am (original)
+++ trunk/Makefile.am Thu Feb 21 23:35:28 2008
@@ -46,6 +46,7 @@
gnome_user_share_SOURCES = \
user_share.c \
user_share.h \
+ user_share-private.h \
http.c \
http.h \
obexftp.c \
@@ -58,8 +59,9 @@
$(SELINUX_LIBS) \
$(X_LIBS) $(X_PRE_LIBS) -lX11 $(X_EXTRA_LIBS)
-gnome_file_share_properties_SOURCES = \
- file-share-properties.c
+gnome_file_share_properties_SOURCES = \
+ file-share-properties.c \
+ user_share-private.h
gnome_file_share_properties_LDADD = \
$(USER_SHARE_CONFIG_LIBS)
Modified: trunk/desktop_gnome_file_sharing.schemas.in
==============================================================================
--- trunk/desktop_gnome_file_sharing.schemas.in (original)
+++ trunk/desktop_gnome_file_sharing.schemas.in Thu Feb 21 23:35:28 2008
@@ -45,5 +45,16 @@
<long>Whether to allow Bluetooth clients to write files, or share the files read-only.</long>
</locale>
</schema>
+ <schema>
+ <key>/schemas/desktop/gnome/file_sharing/bluetooth_require_pairing</key>
+ <applyto>/desktop/gnome/file_sharing/bluetooth_require_pairing</applyto>
+ <owner>gnome-user-share</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Whether Bluetooth clients need to pair with the computer to send files.</short>
+ <long>Whether Bluetooth clients need to pair with the computer to send files.</long>
+ </locale>
+ </schema>
</schemalist>
</gconfschemafile>
Modified: trunk/file-share-properties.c
==============================================================================
--- trunk/file-share-properties.c (original)
+++ trunk/file-share-properties.c Thu Feb 21 23:35:28 2008
@@ -31,11 +31,7 @@
#include <glade/glade.h>
#include <gconf/gconf-client.h>
-#define FILE_SHARING_DIR "/desktop/gnome/file_sharing"
-#define FILE_SHARING_ENABLED "/desktop/gnome/file_sharing/enabled"
-#define FILE_SHARING_BLUETOOTH_ENABLED "/desktop/gnome/file_sharing/bluetooth_enabled"
-#define FILE_SHARING_REQUIRE_PASSWORD "/desktop/gnome/file_sharing/require_password"
-#define FILE_SHARING_BLUETOOTH_ALLOW_WRITE "/desktop/gnome/file_sharing/bluetooth_allow_write"
+#include "user_share-private.h"
#define REALM "Please log in as the user guest"
#define USER "guest"
@@ -132,7 +128,7 @@
update_ui (void)
{
GConfClient *client;
- gboolean enabled, bluetooth_enabled, bluetooth_write_enabled;
+ gboolean enabled, bluetooth_enabled, bluetooth_write_enabled, require_pairing_enabled;
char *str;
PasswordSetting password_setting;
GtkWidget *check;
@@ -140,6 +136,7 @@
GtkWidget *password_entry;
GtkWidget *bluetooth_check;
GtkWidget *allow_write_bluetooth_check;
+ GtkWidget *require_pairing_check;
client = gconf_client_get_default ();
@@ -152,6 +149,9 @@
bluetooth_write_enabled = gconf_client_get_bool (client,
FILE_SHARING_BLUETOOTH_ALLOW_WRITE,
NULL);
+ require_pairing_enabled = gconf_client_get_bool (client,
+ FILE_SHARING_BLUETOOTH_REQUIRE_PAIRING,
+ NULL);
str = gconf_client_get_string (client, FILE_SHARING_REQUIRE_PASSWORD, NULL);
password_setting = password_setting_from_string (str);
@@ -162,6 +162,7 @@
password_entry = glade_xml_get_widget (ui, "password_entry");
bluetooth_check = glade_xml_get_widget (ui, "enable_bluetooth_check");
allow_write_bluetooth_check = glade_xml_get_widget (ui, "allow_write_bluetooth_check");
+ require_pairing_check = glade_xml_get_widget (ui, "require_pairing_check");
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), enabled);
gtk_widget_set_sensitive (password_combo, enabled);
@@ -172,9 +173,12 @@
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bluetooth_check), bluetooth_enabled);
gtk_widget_set_sensitive (allow_write_bluetooth_check, bluetooth_enabled);
+ gtk_widget_set_sensitive (require_pairing_check, bluetooth_enabled);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (allow_write_bluetooth_check),
bluetooth_write_enabled);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (require_pairing_check),
+ require_pairing_enabled);
g_object_unref (client);
}
@@ -216,6 +220,15 @@
}
static void
+file_sharing_bluetooth_require_pairing_changed (GConfClient* client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer data)
+{
+ update_ui ();
+}
+
+static void
password_combo_changed (GtkComboBox *combo_box)
{
GConfClient *client;
@@ -429,6 +442,12 @@
NULL,
NULL,
NULL);
+ gconf_client_notify_add (client,
+ FILE_SHARING_BLUETOOTH_REQUIRE_PAIRING,
+ file_sharing_bluetooth_require_pairing_changed,
+ NULL,
+ NULL,
+ NULL);
g_object_unref (client);
Modified: trunk/file-share-properties.glade
==============================================================================
--- trunk/file-share-properties.glade (original)
+++ trunk/file-share-properties.glade Thu Feb 21 23:35:28 2008
@@ -11,6 +11,7 @@
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
+ <property name="icon_name">apacheconf</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
@@ -24,7 +25,7 @@
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
- <property name="spacing">0</property>
+ <property name="spacing">12</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
@@ -74,7 +75,7 @@
<child>
<widget class="GtkTable" id="table2">
<property name="visible">True</property>
- <property name="n_rows">5</property>
+ <property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
@@ -195,6 +196,65 @@
<property name="y_options"></property>
</packing>
</child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><b>Share Files over the network</b></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkFrame" id="frame3">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0.5</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment3">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">6</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
<child>
<widget class="GtkCheckButton" id="enable_bluetooth_check">
@@ -209,12 +269,9 @@
<property name="draw_indicator">True</property>
</widget>
<packing>
- <property name="left_attach">0</property>
- <property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
@@ -231,12 +288,28 @@
<property name="draw_indicator">True</property>
</widget>
<packing>
- <property name="left_attach">0</property>
- <property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCheckButton" id="require_pairing_check">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Require remote devices to pair with this computer</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
</packing>
</child>
</widget>
@@ -245,9 +318,9 @@
</child>
<child>
- <widget class="GtkLabel" id="label6">
+ <widget class="GtkLabel" id="label7">
<property name="visible">True</property>
- <property name="label" translatable="yes"><b>Share Files</b></property>
+ <property name="label" translatable="yes"><b>Share Files over Bluetooth</b></property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
Modified: trunk/http.c
==============================================================================
--- trunk/http.c (original)
+++ trunk/http.c Thu Feb 21 23:35:28 2008
@@ -65,6 +65,7 @@
#endif
#include "user_share.h"
+#include "user_share-private.h"
#include "http.h"
#ifdef HAVE_DBUS_1_1
Modified: trunk/obexftp.c
==============================================================================
--- trunk/obexftp.c (original)
+++ trunk/obexftp.c Thu Feb 21 23:35:28 2008
@@ -30,6 +30,7 @@
#include "obexftp.h"
#include "user_share.h"
+#include "user_share-private.h"
static DBusGConnection *connection = NULL;
static DBusGProxy *manager_proxy = NULL;
@@ -41,7 +42,10 @@
GError *err = NULL;
GConfClient *client;
char *public_dir, *session;
- gboolean allow_write;
+ gboolean allow_write, require_pairing;
+
+ client = gconf_client_get_default ();
+ require_pairing = gconf_client_get_bool (client, FILE_SHARING_BLUETOOTH_REQUIRE_PAIRING, NULL);
session = NULL;
if (manager_proxy == NULL) {
@@ -50,7 +54,7 @@
"/org/openobex",
"org.openobex.Manager");
if (dbus_g_proxy_call (manager_proxy, "CreateBluetoothServer",
- &err, G_TYPE_STRING, "00:00:00:00:00:00", G_TYPE_STRING, "ftp", G_TYPE_INVALID,
+ &err, G_TYPE_STRING, "00:00:00:00:00:00", G_TYPE_STRING, "ftp", G_TYPE_BOOLEAN, require_pairing, G_TYPE_INVALID,
DBUS_TYPE_G_OBJECT_PATH, &session, G_TYPE_INVALID) == FALSE) {
g_printerr ("Creating Bluetooth server failed: %s\n",
err->message);
@@ -62,7 +66,6 @@
}
public_dir = lookup_public_dir ();
- client = gconf_client_get_default ();
allow_write = gconf_client_get_bool (client, FILE_SHARING_BLUETOOTH_ALLOW_WRITE, NULL);
g_object_unref (client);
@@ -74,7 +77,7 @@
g_free (session);
}
if (dbus_g_proxy_call (server_proxy, "Start", &err,
- G_TYPE_STRING, public_dir, G_TYPE_BOOLEAN, allow_write, G_TYPE_INVALID,
+ G_TYPE_STRING, public_dir, G_TYPE_BOOLEAN, allow_write, G_TYPE_BOOLEAN, TRUE, G_TYPE_INVALID,
G_TYPE_INVALID) == FALSE) {
g_printerr ("Starting Bluetooth server session failed: %s\n",
err->message);
Added: trunk/user_share-private.h
==============================================================================
--- (empty file)
+++ trunk/user_share-private.h Thu Feb 21 23:35:28 2008
@@ -0,0 +1,8 @@
+#define FILE_SHARING_DIR "/desktop/gnome/file_sharing"
+#define FILE_SHARING_ENABLED FILE_SHARING_DIR "/enabled"
+#define FILE_SHARING_BLUETOOTH_ENABLED FILE_SHARING_DIR "/bluetooth_enabled"
+#define FILE_SHARING_REQUIRE_PASSWORD FILE_SHARING_DIR "/require_password"
+#define FILE_SHARING_BLUETOOTH_ALLOW_WRITE FILE_SHARING_DIR "/bluetooth_allow_write"
+#define FILE_SHARING_BLUETOOTH_REQUIRE_PAIRING FILE_SHARING_DIR "/bluetooth_require_pairing"
+
+
Modified: trunk/user_share.c
==============================================================================
--- trunk/user_share.c (original)
+++ trunk/user_share.c Thu Feb 21 23:35:28 2008
@@ -28,6 +28,7 @@
#include <X11/Xlib.h>
#include "user_share.h"
+#include "user_share-private.h"
#include "http.h"
#include "obexftp.h"
@@ -60,6 +61,23 @@
return dir;
}
+char *
+lookup_download_dir (void)
+{
+ const char *download_dir;
+ char *dir;
+
+ download_dir = g_get_user_special_dir (G_USER_DIRECTORY_DOWNLOAD);
+ if (download_dir != NULL && strcmp (download_dir, g_get_home_dir ()) != 0) {
+ g_mkdir_with_parents (download_dir, 0755);
+ return g_strdup (download_dir);
+ }
+
+ dir = g_build_filename (g_get_home_dir (), "Download", NULL);
+ g_mkdir_with_parents (dir, 0755);
+ return dir;
+}
+
static void
require_password_changed (GConfClient* client,
guint cnxn_id,
@@ -124,6 +142,15 @@
}
static void
+file_sharing_bluetooth_require_pairing_changed (GConfClient* client,
+ guint cnxn_id,
+ GConfEntry *entry,
+ gpointer data)
+{
+ obexftp_restart ();
+}
+
+static void
file_sharing_bluetooth_enabled_changed (GConfClient* client,
guint cnxn_id,
GConfEntry *entry,
@@ -263,6 +290,13 @@
NULL,
NULL,
NULL);
+ gconf_client_notify_add (client,
+ FILE_SHARING_BLUETOOTH_REQUIRE_PAIRING,
+ file_sharing_bluetooth_require_pairing_changed,
+ NULL,
+ NULL,
+ NULL);
+
g_object_unref (client);
/* Initial setting */
Modified: trunk/user_share.h
==============================================================================
--- trunk/user_share.h (original)
+++ trunk/user_share.h Thu Feb 21 23:35:28 2008
@@ -21,11 +21,6 @@
*
*/
-#define FILE_SHARING_DIR "/desktop/gnome/file_sharing"
-#define FILE_SHARING_ENABLED "/desktop/gnome/file_sharing/enabled"
-#define FILE_SHARING_BLUETOOTH_ENABLED "/desktop/gnome/file_sharing/bluetooth_enabled"
-#define FILE_SHARING_REQUIRE_PASSWORD "/desktop/gnome/file_sharing/require_password"
-#define FILE_SHARING_BLUETOOTH_ALLOW_WRITE "/desktop/gnome/file_sharing/bluetooth_allow_write"
-
char *lookup_public_dir (void);
+char *lookup_download_dir (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]