gnome-commander r1844 - in trunk: . doc/C src



Author: epiotr
Date: Sat Jun 14 22:35:18 2008
New Revision: 1844
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=1844&view=rev

Log:
Added copying selected URIs to clipboard with ALT+click on toolbar button

Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/doc/C/gnome-commander.xml
   trunk/src/gnome-cmd-main-win.cc
   trunk/src/gnome-cmd-user-actions.cc

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Sat Jun 14 22:35:18 2008
@@ -8,6 +8,7 @@
 
 New features:
  * User defined shortcuts to arbitrary programs
+ * Copying selected URIs to clipboard with ALT+click on toolbar button
  * Updated help docs
  * New or updated translations: cs, de, es, pl
  * New key bindings:

Modified: trunk/doc/C/gnome-commander.xml
==============================================================================
--- trunk/doc/C/gnome-commander.xml	(original)
+++ trunk/doc/C/gnome-commander.xml	Sat Jun 14 22:35:18 2008
@@ -5932,6 +5932,9 @@
                             <para>User defined shortcuts to arbitrary programs</para>
                         </listitem>
                         <listitem>
+                            <para>Copying selected URIs to clipboard with <keycombo><keycap>ALT</keycap><keycap>click</keycap></keycombo> on toolbar button</para>
+                        </listitem>
+                        <listitem>
                             <para>Updated help docs</para>
                         </listitem>
                         <listitem>

Modified: trunk/src/gnome-cmd-main-win.cc
==============================================================================
--- trunk/src/gnome-cmd-main-win.cc	(original)
+++ trunk/src/gnome-cmd-main-win.cc	Sat Jun 14 22:35:18 2008
@@ -1159,7 +1159,7 @@
         GNOMEUIINFO_ITEM_STOCK(NULL, _("Go forward"), view_forward, GTK_STOCK_GO_FORWARD),
         GNOMEUIINFO_ITEM_STOCK(NULL, _("Goto the latest"), view_last, GTK_STOCK_GOTO_LAST),
         GNOMEUIINFO_SEPARATOR,
-        GNOMEUIINFO_ITEM(NULL, _("Copy file names (SHIFT for full paths)"), edit_copy_fnames, copy_file_names_xpm),
+        GNOMEUIINFO_ITEM(NULL, _("Copy file names (SHIFT for full paths, ALT for URIs)"), edit_copy_fnames, copy_file_names_xpm),
         GNOMEUIINFO_ITEM_STOCK(NULL, _("Cut"), edit_cap_cut, GTK_STOCK_CUT),
         GNOMEUIINFO_ITEM_STOCK(NULL, _("Copy"), edit_cap_copy, GTK_STOCK_COPY),
         GNOMEUIINFO_ITEM_STOCK(NULL, _("Paste"), edit_cap_paste, GTK_STOCK_PASTE),

Modified: trunk/src/gnome-cmd-user-actions.cc
==============================================================================
--- trunk/src/gnome-cmd-user-actions.cc	(original)
+++ trunk/src/gnome-cmd-user-actions.cc	Sat Jun 14 22:35:18 2008
@@ -577,6 +577,30 @@
 }
 
 
+template <typename F>
+inline void get_file_list (string &s, GList *sfl, F f)
+{
+    vector<string> a;
+
+    for (GList *i = sfl; i; i = i->next)
+        a.push_back ((*f) (GNOME_CMD_FILE (i->data)));
+
+    join (s, a.begin(), a.end());
+}
+
+
+template <typename F, typename T>
+inline void get_file_list (string &s, GList *sfl, F f, T t)
+{
+    vector<string> a;
+
+    for (GList *i = sfl; i; i = i->next)
+        a.push_back ((*f) (GNOME_CMD_FILE (i->data), t));
+
+    join (s, a.begin(), a.end());
+}
+
+
 /***************************************/
 void no_action (GtkMenuItem *menuitem, gpointer not_used)
 {
@@ -870,65 +894,34 @@
 
 void edit_copy_fnames (GtkMenuItem *menuitem, gpointer not_used)
 {
-    static gchar sep[] = " ";
-
     GdkModifierType mask;
 
     gdk_window_get_pointer (NULL, NULL, NULL, &mask);
 
     GnomeCmdFileList *fl = get_fl (ACTIVE);
     GList *sfl = gnome_cmd_file_list_get_selected_files (fl);
-    gchar **fnames = g_new (char *, g_list_length (sfl) + 1);
-    gchar **f = fnames;
-
     sfl = gnome_cmd_file_list_sort_selection (sfl, fl);
 
-    for (GList *i = sfl; i; i = i->next)
-    {
-        GnomeCmdFile *finfo = GNOME_CMD_FILE (i->data);
-
-        if (finfo)
-          *f++ = (mask & GDK_SHIFT_MASK) ? (char *) gnome_cmd_file_get_real_path (finfo) :
-                                           (char *) gnome_cmd_file_get_name (finfo);
-    }
+    string fnames;
 
-    *f = NULL;
+    fnames.reserve(2000);
 
-    gchar *s = g_strjoinv(sep,fnames);
+    if (state_is_blank (mask))
+        get_file_list (fnames, sfl, gnome_cmd_file_get_name);
+    else
+        if (state_is_shift (mask))
+            get_file_list (fnames, sfl, gnome_cmd_file_get_real_path);
+        else
+            if (state_is_alt (mask))
+                get_file_list (fnames, sfl, gnome_cmd_file_get_uri_str, GNOME_VFS_URI_HIDE_PASSWORD);
 
-    gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), s, -1);
+    gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), fnames.c_str(), -1);
 
-    g_free (s);
     g_list_free (sfl);
-    g_free (fnames);
 }
 
 
 /************** Command Menu **************/
-template <typename F>
-inline void get_file_list (string &s, GList *sfl, F f)
-{
-    vector<string> a;
-
-    for (GList *i = sfl; i; i = i->next)
-        a.push_back ((*f) (GNOME_CMD_FILE (i->data)));
-
-    join (s, a.begin(), a.end());
-}
-
-
-template <typename F, typename T>
-inline void get_file_list (string &s, GList *sfl, F f, T t)
-{
-    vector<string> a;
-
-    for (GList *i = sfl; i; i = i->next)
-        a.push_back ((*f) (GNOME_CMD_FILE (i->data), t));
-
-    join (s, a.begin(), a.end());
-}
-
-
 void command_execute (GtkMenuItem *menuitem, gpointer command)
 {
     g_return_if_fail (command != NULL);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]