gnome-commander r1845 - in branches/gcmd-1-3: . doc/C src



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

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

Modified:
   branches/gcmd-1-3/ChangeLog
   branches/gcmd-1-3/doc/C/gnome-commander.xml
   branches/gcmd-1-3/src/gnome-cmd-main-win.cc
   branches/gcmd-1-3/src/gnome-cmd-user-actions.cc

Modified: branches/gcmd-1-3/doc/C/gnome-commander.xml
==============================================================================
--- branches/gcmd-1-3/doc/C/gnome-commander.xml	(original)
+++ branches/gcmd-1-3/doc/C/gnome-commander.xml	Sat Jun 14 22:35:35 2008
@@ -5888,6 +5888,9 @@
                             <para>Support for &lt;super&gt;, &lt;hyper&gt; and &lt;meta&gt; modifiers (since GTK+ 2.10)</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: branches/gcmd-1-3/src/gnome-cmd-main-win.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-main-win.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-main-win.cc	Sat Jun 14 22:35:35 2008
@@ -1164,7 +1164,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: branches/gcmd-1-3/src/gnome-cmd-user-actions.cc
==============================================================================
--- branches/gcmd-1-3/src/gnome-cmd-user-actions.cc	(original)
+++ branches/gcmd-1-3/src/gnome-cmd-user-actions.cc	Sat Jun 14 22:35:35 2008
@@ -578,6 +578,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)
 {
@@ -871,65 +895,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]