[Goodies-commits] r6683 - in thunar-shares-plugin/trunk: . libshares po thunar-plugin
Daniel Morales
danielm at xfce.org
Sat Feb 14 05:07:06 CET 2009
Author: danielm
Date: 2009-02-14 04:07:06 +0000 (Sat, 14 Feb 2009)
New Revision: 6683
Removed:
thunar-shares-plugin/trunk/thunar-plugin/tsp-admin-editor.c
thunar-shares-plugin/trunk/thunar-plugin/tsp-admin-editor.h
thunar-shares-plugin/trunk/thunar-plugin/tsp-admin.c
thunar-shares-plugin/trunk/thunar-plugin/tsp-admin.h
Modified:
thunar-shares-plugin/trunk/ChangeLog
thunar-shares-plugin/trunk/TODO
thunar-shares-plugin/trunk/libshares/libshares-util.c
thunar-shares-plugin/trunk/po/POTFILES.in
thunar-shares-plugin/trunk/thunar-plugin/Makefile.am
thunar-shares-plugin/trunk/thunar-plugin/thunar-shares-plugin.c
thunar-shares-plugin/trunk/thunar-plugin/tsp-page.c
thunar-shares-plugin/trunk/thunar-plugin/tsp-provider.c
Log:
* Changed notification system. Let's use "changed" from thunarx.
* Dropped "admin" and "editor" dialogs. The preferences menu isn't a good
place for them. Maybe they can will added as a helper program some day.
* thunar-plugin/tsp-page.c: Do not display error message in dialogs,
Modified: thunar-shares-plugin/trunk/ChangeLog
===================================================================
--- thunar-shares-plugin/trunk/ChangeLog 2009-02-13 16:16:58 UTC (rev 6682)
+++ thunar-shares-plugin/trunk/ChangeLog 2009-02-14 04:07:06 UTC (rev 6683)
@@ -1,10 +1,14 @@
+2009-02-14 Daniel Morales <daniel at daniel.com.uy>
+
+ * Changed notification system. Let's use "changed" from thunarx.
+ * Dropped "admin" and "editor" dialogs. The preferences menu isn't a good
+ place for them. Maybe they can will added as a helper program some day.
+
2009-02-02 Daniel Morales <daniel at daniel.com.uy>
* libshares/shares.c:
- * thunar-plugin/tsp-page.c:
- * thunar-plugin/tsp-admin.c: Do not display error message in dialogs,
+ * thunar-plugin/tsp-page.c: Do not display error message in dialogs,
let's display that errors on a embed label.
- * thunar-plugin/tsp-admin-editor.c: Fixed message string.
* po/thunar-shares-plugin.pot: Bring back the POT file.
2009-01-27 Daniel Morales <daniel at daniel.com.uy>
Modified: thunar-shares-plugin/trunk/TODO
===================================================================
--- thunar-shares-plugin/trunk/TODO 2009-02-13 16:16:58 UTC (rev 6682)
+++ thunar-shares-plugin/trunk/TODO 2009-02-14 04:07:06 UTC (rev 6683)
@@ -4,19 +4,4 @@
* Add emblems to shared folders (Thunar doesn't allow to add/remove
emblembs from plugins yet).
- * Maybe some help button at shares-admin dialog.
-
- * We need to review the permissions hierarchy check:
- (libshares/libshares-util.c: tsp_check_perms)
-
- * Review que pasa cuando una carpeta es borrada.
-
- * Review multi usuario. Crear una carpeta compartida. Crear otro usuario,
- probar todo eso.
-
- * Checkeo de owner_only (?).
-
- * Y errores mejor en tab_page. Sobretodo porque va mostrar siempre ese
- mensaje cuando no se pueda compartir.
-
- * Revisar dialogo modal de shares admin
+ * Add owner only check
Modified: thunar-shares-plugin/trunk/libshares/libshares-util.c
===================================================================
--- thunar-shares-plugin/trunk/libshares/libshares-util.c 2009-02-13 16:16:58 UTC (rev 6682)
+++ thunar-shares-plugin/trunk/libshares/libshares-util.c 2009-02-14 04:07:06 UTC (rev 6683)
@@ -122,12 +122,6 @@
}
}
- /* Notify changes */
- if (ret)
- {
- libshares_monitor_feed (path);
- }
-
return ret;
}
@@ -222,12 +216,6 @@
}
}
- /* Notify changes */
- if (share_info)
- {
- libshares_monitor_feed (file_local);
- }
-
return share_info;
}
@@ -316,30 +304,6 @@
return retval;
}
-/**
- * libshares_monitor_feed:
- * @uri: Absolute path or URI of the file.
- *
- * Notify the file system about shareing changes.
- **/
-void
-libshares_monitor_feed (const gchar *uri)
-{
- ThunarVfsMonitor *monitor;
- ThunarVfsPath *path;
-
- path = thunar_vfs_path_new (uri, NULL);
-
- if (G_LIKELY (path != NULL))
- {
- monitor = thunar_vfs_monitor_get_default ();
- thunar_vfs_monitor_feed (monitor, THUNAR_VFS_MONITOR_EVENT_CHANGED, path);
-
- g_object_unref (monitor);
- thunar_vfs_path_unref (path);
- }
-}
-
/* Asks to the user if we can change the permissions of the folder */
static gboolean
tsp_ask_perms (gboolean need_r,
Modified: thunar-shares-plugin/trunk/po/POTFILES.in
===================================================================
--- thunar-shares-plugin/trunk/po/POTFILES.in 2009-02-13 16:16:58 UTC (rev 6682)
+++ thunar-shares-plugin/trunk/po/POTFILES.in 2009-02-14 04:07:06 UTC (rev 6683)
@@ -3,7 +3,5 @@
libshares/libshares-util.c
libshares/shares.c
thunar-plugin/thunar-shares-plugin.c
-thunar-plugin/tsp-admin.c
-thunar-plugin/tsp-admin-editor.c
thunar-plugin/tsp-page.c
thunar-plugin/tsp-provider.c
Modified: thunar-shares-plugin/trunk/thunar-plugin/Makefile.am
===================================================================
--- thunar-shares-plugin/trunk/thunar-plugin/Makefile.am 2009-02-13 16:16:58 UTC (rev 6682)
+++ thunar-shares-plugin/trunk/thunar-plugin/Makefile.am 2009-02-14 04:07:06 UTC (rev 6683)
@@ -13,9 +13,7 @@
thunar_shares_plugin_la_SOURCES = \
thunar-shares-plugin.c \
tsp-page.c tsp-page.h \
- tsp-admin.c tsp-admin.h \
- tsp-provider.c tsp-provider.h \
- tsp-admin-editor.c tsp-admin-editor.h
+ tsp-provider.c tsp-provider.h
thunar_shares_plugin_la_CFLAGS = \
$(PLATFORM_CFLAGS) \
Modified: thunar-shares-plugin/trunk/thunar-plugin/thunar-shares-plugin.c
===================================================================
--- thunar-shares-plugin/trunk/thunar-plugin/thunar-shares-plugin.c 2009-02-13 16:16:58 UTC (rev 6682)
+++ thunar-shares-plugin/trunk/thunar-plugin/thunar-shares-plugin.c 2009-02-14 04:07:06 UTC (rev 6683)
@@ -25,9 +25,7 @@
#include <glib/gi18n.h>
#include <libshares/shares.h>
-#include "tsp-admin-editor.h"
#include "tsp-provider.h"
-#include "tsp-admin.h"
#include "tsp-page.h"
static GType type_list[1];
@@ -57,8 +55,6 @@
/* register the types provided by this plugin */
tsp_page_register_type (plugin);
- tsp_admin_editor_register_type (plugin);
- tsp_admin_manager_register_type (plugin);
tsp_provider_register_type (plugin);
/* setup the plugin provider type list */
Modified: thunar-shares-plugin/trunk/thunar-plugin/tsp-page.c
===================================================================
--- thunar-shares-plugin/trunk/thunar-plugin/tsp-page.c 2009-02-13 16:16:58 UTC (rev 6682)
+++ thunar-shares-plugin/trunk/thunar-plugin/tsp-page.c 2009-02-14 04:07:06 UTC (rev 6683)
@@ -22,8 +22,8 @@
#include <config.h>
#endif
+#include <glib/gi18n.h>
#include <gtk/gtk.h>
-#include <thunar-vfs/thunar-vfs.h>
#include <libshares/shares.h>
#include <libshares/libshares-util.h>
@@ -48,12 +48,8 @@
guint prop_id,
const GValue *value,
GParamSpec *pspec);
-static void tsp_page_file_changed (ThunarVfsMonitor *monitor,
- ThunarVfsMonitorHandle *handle,
- ThunarVfsMonitorEvent event,
- ThunarVfsPath *handle_path,
- ThunarVfsPath *event_path,
- gpointer user_data);
+static void tsp_page_file_changed (ThunarxFileInfo *file,
+ gpointer user_data);
static void tsp_page_share_toggled (GtkToggleButton *togglebutton,
TspPage *tsp_page);
static void tsp_page_write_toggled (GtkToggleButton *togglebutton,
@@ -86,8 +82,6 @@
ThunarxPropertyPage __parent__;
ThunarxFileInfo *file;
- ThunarVfsMonitorHandle *handle;
-
GtkWidget *cb_share_folder;
GtkWidget *entry_share_name;
GtkWidget *cb_share_write;
@@ -312,62 +306,38 @@
tsp_page_set_file (TspPage *tsp_page,
ThunarxFileInfo *file)
{
- ThunarVfsMonitor *monitor;
- ThunarVfsPath *path;
- gchar *uri;
-
g_return_if_fail (TSP_IS_PAGE (tsp_page));
g_return_if_fail (file == NULL || THUNARX_IS_FILE_INFO (file));
- if (tsp_page->file == file){
+ /* Check if we already use this file */
+ if (G_UNLIKELY (tsp_page->file == file))
return;
- }
- monitor = thunar_vfs_monitor_get_default ();
-
- if (G_LIKELY (tsp_page->handle != NULL))
- {
- thunar_vfs_monitor_remove (monitor, tsp_page->handle);
- tsp_page->handle = NULL;
- }
-
+ /* Disconnect from the previous file (if any) */
if (G_LIKELY (tsp_page->file != NULL))
{
+ g_signal_handlers_disconnect_by_func (G_OBJECT (tsp_page->file), tsp_page_file_changed, tsp_page);
g_object_unref (G_OBJECT (tsp_page->file));
}
+ /* Assign the value */
tsp_page->file = file;
- if (file != NULL)
+ /* Connect to the new file (if any) */
+ if (G_LIKELY (file != NULL))
{
- g_object_ref (tsp_page->file);
- tsp_page_file_changed (NULL, NULL, THUNAR_VFS_MONITOR_EVENT_CHANGED, NULL, NULL, tsp_page);
-
- /* Let's monitor file changes */
- uri = thunarx_file_info_get_uri (tsp_page->file);
- path = thunar_vfs_path_new (uri, NULL);
+ /* Take a reference on the info file */
+ g_object_ref (G_OBJECT (tsp_page->file));
+ tsp_page_file_changed (file, tsp_page);
- if (G_LIKELY (path != NULL))
- {
- tsp_page->handle = thunar_vfs_monitor_add_file (monitor, path, tsp_page_file_changed, tsp_page);
- thunar_vfs_path_unref (path);
- }
-
- g_free (uri);
+ g_signal_connect (G_OBJECT (file), "changed", G_CALLBACK (tsp_page_file_changed), tsp_page);
}
-
- g_object_unref (monitor);
- g_object_notify (G_OBJECT (tsp_page), "file");
}
/* File changed */
static void
-tsp_page_file_changed (ThunarVfsMonitor *monitor,
- ThunarVfsMonitorHandle *handle,
- ThunarVfsMonitorEvent event,
- ThunarVfsPath *handle_path,
- ThunarVfsPath *event_path,
- gpointer user_data)
+tsp_page_file_changed (ThunarxFileInfo *file,
+ gpointer user_data)
{
ShareInfo *share_info;
gboolean result;
@@ -375,12 +345,10 @@
GError *error = NULL;
gchar *uri, *file_local;
- if (G_LIKELY (event != THUNAR_VFS_MONITOR_EVENT_CHANGED)){
- return;
- }
-
tsp_page = TSP_PAGE (user_data);
+ tsp_page->file = file;
+
/* Load share info */
uri = thunarx_file_info_get_uri (tsp_page->file);
file_local = g_filename_from_uri (uri, NULL, NULL);
@@ -395,8 +363,8 @@
if (!result)
{
tsp_page_set_error (tsp_page, _("You may need to install Samba, check your "
- "user permissions(usershares group) and re-login."
- "\n<b>More info:</b> <u>http://thunar-shares.googlecode.com/</u>"));
+ "user permissions(usershares group) and re-login."
+ "\n<b>More info:</b> <u>http://thunar-shares.googlecode.com/</u>"));
g_error_free (error);
@@ -529,6 +497,8 @@
tsp_update_default (tsp_page, NULL);
}
}
+
+ thunarx_file_info_changed (tsp_page->file);
g_free (local_file);
}
Modified: thunar-shares-plugin/trunk/thunar-plugin/tsp-provider.c
===================================================================
--- thunar-shares-plugin/trunk/thunar-plugin/tsp-provider.c 2009-02-13 16:16:58 UTC (rev 6682)
+++ thunar-shares-plugin/trunk/thunar-plugin/tsp-provider.c 2009-02-14 04:07:06 UTC (rev 6683)
@@ -23,14 +23,11 @@
#endif
#include <thunarx/thunarx.h>
-#include <thunar-vfs/thunar-vfs.h>
-#include <libshares/shares.h>
#include <libshares/libshares-util.h>
#include "tsp-provider.h"
#include "tsp-page.h"
-#include "tsp-admin.h"
static void tsp_provider_class_init (TspProviderClass *klass);
static void tsp_provider_init (TspProvider *tsp_provider);
@@ -42,11 +39,6 @@
static GList *tsp_provider_get_pages (ThunarxPropertyPageProvider *provider,
GList *files);
-static GList *tsp_provider_get_actions (ThunarxPreferencesProvider *provider,
- GtkWidget *window);
-
-static void tsp_provider_prefs_activated (GtkWindow *window);
-
struct _TspProviderClass
{
GObjectClass __parent__;
@@ -57,8 +49,6 @@
GObject __parent__;
};
-static GQuark tsp_action_folders_quark;
-
THUNARX_DEFINE_TYPE_WITH_CODE (TspProvider,
tsp_provider,
G_TYPE_OBJECT,
@@ -72,9 +62,6 @@
{
GObjectClass *gobject_class;
- /* Quark for folders and actions */
- tsp_action_folders_quark = g_quark_from_string ("tsp-action-folders");
-
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = tsp_provider_finalize;
}
@@ -88,8 +75,6 @@
static void
tsp_provider_finalize (GObject *object)
{
- /*TspProvider *tsp_provider = TSP_PROVIDER (object);*/
-
(*G_OBJECT_CLASS (tsp_provider_parent_class)->finalize) (object);
}
@@ -102,7 +87,7 @@
static void
tsp_provider_prefs_provider_init (ThunarxPreferencesProviderIface *iface)
{
- iface->get_actions = tsp_provider_get_actions;
+ /* Bleh..! */
}
static GList*
@@ -117,35 +102,3 @@
return g_list_append (NULL, (gpointer)tsp_page_new (files->data));
}
-
-static GList*
-tsp_provider_get_actions (ThunarxPreferencesProvider *provider,
- GtkWidget *window)
-{
- GtkAction *action;
- GClosure *closure;
-
- action = gtk_action_new ("Tsp::thunar-shares-admin",
- _("Manage shared folders..."),
- _("Add, edit and remove shared folders"),
- NULL);
-
- g_object_set (G_OBJECT (action), "icon-name", "gnome-fs-share", NULL);
-
- closure = g_cclosure_new_object_swap (
- G_CALLBACK (tsp_provider_prefs_activated), G_OBJECT (window));
-
- g_signal_connect_closure (G_OBJECT (action), "activate", closure, TRUE);
-
- return g_list_prepend (NULL, action);
-}
-
-static void
-tsp_provider_prefs_activated (GtkWindow *window)
-{
- GtkWidget *dialog;
-
- dialog = tsp_admin_manager_new (window);
-
- gtk_widget_show (dialog);
-}
More information about the Goodies-commits
mailing list