gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r7111 - in gnunet-gtk: . src/plugins/fs


From: gnunet
Subject: [GNUnet-SVN] r7111 - in gnunet-gtk: . src/plugins/fs
Date: Mon, 9 Jun 2008 11:54:22 -0600 (MDT)

Author: moon
Date: 2008-06-09 11:54:20 -0600 (Mon, 09 Jun 2008)
New Revision: 7111

Modified:
   gnunet-gtk/gnunet-gtk.glade
   gnunet-gtk/src/plugins/fs/download.c
   gnunet-gtk/src/plugins/fs/fs.c
Log:
context menus for uploads and downloads lists
a few cosmetic improvements
double-click to download from search results
(end of revision 7104)



Modified: gnunet-gtk/gnunet-gtk.glade
===================================================================
--- gnunet-gtk/gnunet-gtk.glade 2008-06-09 16:34:31 UTC (rev 7110)
+++ gnunet-gtk/gnunet-gtk.glade 2008-06-09 17:54:20 UTC (rev 7111)
@@ -587,7 +587,7 @@
                             <property name="label">gtk-stop</property>
                             <property name="use_stock">True</property>
                             <property name="response_id">0</property>
-                            <signal name="clicked" 
handler="on_stopUploadButton_clicked_" object="activeUploadsList"/>
+                            <signal name="clicked" 
handler="on_stopUpload_clicked_" object="activeUploadsList"/>
                           </widget>
                           <packing>
                             <property name="expand">False</property>
@@ -600,7 +600,7 @@
                             <property name="can_focus">True</property>
                             <property name="tooltip" translatable="yes">Clear 
completed uploads from the list</property>
                             <property name="response_id">0</property>
-                            <signal name="clicked" 
handler="on_clearCompletedUploadsButton_clicked_"/>
+                            <signal name="clicked" 
handler="on_clearCompletedUploads_clicked_"/>
                             <child>
                               <widget class="GtkAlignment" id="alignment4">
                                 <property name="visible">True</property>
@@ -730,6 +730,7 @@
                             <property name="can_focus">True</property>
                             <property name="reorderable">True</property>
                             <property name="rules_hint">True</property>
+                            <signal name="button_press_event" 
handler="on_activeUploadsList_button_press_"/>
                           </widget>
                         </child>
                       </widget>
@@ -861,11 +862,11 @@
                             <property name="visible">True</property>
                             <property name="sensitive">False</property>
                             <property name="can_focus">True</property>
-                            <property name="tooltip" translatable="yes">Cancel 
the selected download (and all sub-downloads) and delete incomplete 
downloads</property>
+                            <property name="tooltip" translatable="yes">Cancel 
the selected download (and all sub-downloads) and delete incomplete download 
files</property>
                             <property name="label">gtk-delete</property>
                             <property name="use_stock">True</property>
                             <property name="response_id">0</property>
-                            <signal name="clicked" 
handler="on_abortDownloadButton_clicked_"/>
+                            <signal name="clicked" 
handler="on_abortDownload_clicked_"/>
                           </widget>
                           <packing>
                             <property name="fill">False</property>
@@ -880,7 +881,7 @@
                             <property name="label">gtk-stop</property>
                             <property name="use_stock">True</property>
                             <property name="response_id">0</property>
-                            <signal name="clicked" 
handler="on_stopDownloadButton_clicked_"/>
+                            <signal name="clicked" 
handler="on_stopDownload_clicked_"/>
                           </widget>
                           <packing>
                             <property name="fill">False</property>
@@ -893,7 +894,7 @@
                             <property name="can_focus">True</property>
                             <property name="tooltip" translatable="yes">Clear 
completed downloads from the list</property>
                             <property name="response_id">0</property>
-                            <signal name="clicked" 
handler="on_clearCompletedDownloadsButton_clicked_"/>
+                            <signal name="clicked" 
handler="on_clearCompletedDownloads_clicked_"/>
                             <child>
                               <widget class="GtkAlignment" id="alignment3">
                                 <property name="visible">True</property>
@@ -959,6 +960,7 @@
                             <property name="can_focus">True</property>
                             <property name="reorderable">True</property>
                             <property name="rules_hint">True</property>
+                            <signal name="button_press_event" 
handler="on_activeDownloadsList_button_press_"/>
                           </widget>
                         </child>
                       </widget>
@@ -2352,7 +2354,7 @@
                 <child>
                   <widget class="GtkImage" id="image8">
                     <property name="visible">True</property>
-                    <property name="stock">gtk-dialog-info</property>
+                    <property name="stock">gtk-justify-fill</property>
                   </widget>
                 </child>
                 <child>
@@ -2840,6 +2842,7 @@
   <widget class="GtkDialog" id="metaDisplayDialog">
     <property name="visible">True</property>
     <property name="tooltip" translatable="yes">Metadata for the selected 
search result</property>
+    <property name="border_width">5</property>
     <property name="title" translatable="yes">File Information</property>
     <property name="modal">True</property>
     <property name="window_position">GTK_WIN_POS_CENTER</property>
@@ -2854,6 +2857,7 @@
           <widget class="GtkFrame" id="frame14">
             <property name="visible">True</property>
             <property name="label_xalign">0</property>
+            <property name="shadow_type">GTK_SHADOW_NONE</property>
             <child>
               <widget class="GtkScrolledWindow" id="scrolledwindow12">
                 <property name="visible">True</property>
@@ -2873,7 +2877,9 @@
             <child>
               <widget class="GtkLabel" id="label58">
                 <property name="visible">True</property>
-                <property name="label" translatable="yes">Meta-data</property>
+                <property name="ypad">5</property>
+                <property name="label" 
translatable="yes">&lt;b&gt;Meta-data&lt;/b&gt;</property>
+                <property name="use_markup">True</property>
               </widget>
               <packing>
                 <property name="type">label_item</property>
@@ -2892,7 +2898,7 @@
               <widget class="GtkButton" id="fileInformationDoneButton">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
-                <property name="label">gtk-ok</property>
+                <property name="label">gtk-close</property>
                 <property name="use_stock">True</property>
                 <property name="response_id">-5</property>
                 <signal name="clicked" handler="gtk_widget_destroy" 
object="metaDisplayDialog"/>
@@ -2940,6 +2946,7 @@
                         <property name="tooltip" translatable="yes">List of 
search results.  Directories must first be downloaded before their contents 
will be displayed.</property>
                         <property name="reorderable">True</property>
                         <property name="rules_hint">True</property>
+                        <signal name="button_press_event" 
handler="on_searchResults_button_press_"/>
                       </widget>
                     </child>
                   </widget>
@@ -4985,4 +4992,84 @@
       </widget>
     </child>
   </widget>
+  <widget class="GtkMenu" id="downloadsContextMenu">
+    <property name="visible">True</property>
+    <child>
+      <widget class="GtkImageMenuItem" id="delete_download">
+        <property name="visible">True</property>
+        <property name="tooltip" translatable="yes">Cancel the selected 
download (and all sub-downloads) and delete incomplete download files</property>
+        <property name="label" translatable="yes">gtk-delete</property>
+        <property name="use_underline">True</property>
+        <property name="use_stock">True</property>
+        <signal name="activate" handler="on_abortDownload_clicked_"/>
+      </widget>
+    </child>
+    <child>
+      <widget class="GtkImageMenuItem" id="stop_download">
+        <property name="visible">True</property>
+        <property name="tooltip" translatable="yes">Stop the selected download 
(and all sub-downloads) and remove them from the list.  This will NOT cause the 
deletion of files from incomplete downloads.</property>
+        <property name="label" translatable="yes">gtk-stop</property>
+        <property name="use_underline">True</property>
+        <property name="use_stock">True</property>
+        <signal name="activate" handler="on_stopDownload_clicked_"/>
+      </widget>
+    </child>
+    <child>
+      <widget class="GtkImageMenuItem" id="clear_completed_downloads">
+        <property name="visible">True</property>
+        <property name="tooltip" translatable="yes">Clear completed downloads 
from the list</property>
+        <property name="label" translatable="yes">_Clean</property>
+        <property name="use_underline">True</property>
+        <signal name="activate" handler="on_clearCompletedDownloads_clicked_"/>
+        <child internal-child="image">
+          <widget class="GtkImage" id="menu-item-image3">
+            <property name="visible">True</property>
+            <property name="stock">gtk-clear</property>
+          </widget>
+        </child>
+      </widget>
+    </child>
+  </widget>
+  <widget class="GtkMenu" id="uploadsContextMenu">
+    <property name="visible">True</property>
+    <child>
+      <widget class="GtkImageMenuItem" id="stop_upload">
+        <property name="visible">True</property>
+        <property name="tooltip" translatable="yes">Cancel the selected upload 
(and all sub-uploads) and remove them from the list</property>
+        <property name="label" translatable="yes">gtk-stop</property>
+        <property name="use_underline">True</property>
+        <property name="use_stock">True</property>
+        <signal name="activate" handler="on_stopUpload_clicked_"/>
+      </widget>
+    </child>
+    <child>
+      <widget class="GtkImageMenuItem" id="clear_completed_uploads">
+        <property name="visible">True</property>
+        <property name="tooltip" translatable="yes">Clear completed uploads 
from the list</property>
+        <property name="label" translatable="yes">_Clean</property>
+        <property name="use_underline">True</property>
+        <signal name="activate" handler="on_clearCompletedUploads_clicked_"/>
+        <child internal-child="image">
+          <widget class="GtkImage" id="menu-item-image4">
+            <property name="visible">True</property>
+            <property name="stock">gtk-clear</property>
+          </widget>
+        </child>
+      </widget>
+    </child>
+    <child>
+      <widget class="GtkImageMenuItem" id="copy_uri">
+        <property name="visible">True</property>
+        <property name="label" translatable="yes">_Copy URI to 
Clipboard</property>
+        <property name="use_underline">True</property>
+        <signal name="activate" handler="on_upload_copy_uri_activate_"/>
+        <child internal-child="image">
+          <widget class="GtkImage" id="menu-item-image5">
+            <property name="visible">True</property>
+            <property name="stock">gtk-copy</property>
+          </widget>
+        </child>
+      </widget>
+    </child>
+  </widget>
 </glade-interface>

Modified: gnunet-gtk/src/plugins/fs/download.c
===================================================================
--- gnunet-gtk/src/plugins/fs/download.c        2008-06-09 16:34:31 UTC (rev 
7110)
+++ gnunet-gtk/src/plugins/fs/download.c        2008-06-09 17:54:20 UTC (rev 
7111)
@@ -764,7 +764,20 @@
                                               NULL);
 }
 
+/**
+ * Double-click on a search result
+ */
+gboolean
+on_searchResults_button_press_fs (GtkWidget * treeview,
+                                  GdkEventButton * event,
+                                  gpointer data)
+{
+  if (event->type == GDK_2BUTTON_PRESS)
+    on_downloadButton_clicked_fs (treeview, NULL);
+  return FALSE;
+}
 
+
 /**
  * User used the URI download entry.  Start download
  * that is NOT rooted within a search or directory.
@@ -875,7 +888,7 @@
 }
 
 void
-on_clearCompletedDownloadsButton_clicked_fs (void *unused,
+on_clearCompletedDownloads_clicked_fs (void *unused,
                                              GtkWidget * clearButton)
 {
   GNUNET_GTK_tree_model_foreach (GTK_TREE_MODEL (download_summary),
@@ -898,7 +911,7 @@
 }
 
 void
-on_abortDownloadButton_clicked_fs (void *unused, GtkWidget * abortButton)
+on_abortDownload_clicked_fs (void *unused, GtkWidget * dummy)
 {
   GtkTreeSelection *selection;
   GtkWidget *downloadList;
@@ -914,7 +927,7 @@
 }
 
 void
-on_stopDownloadButton_clicked_fs (void *unused, GtkWidget * stopButton)
+on_stopDownload_clicked_fs (void *unused, GtkWidget * dummy)
 {
   GtkTreeSelection *selection;
   GtkWidget *downloadList;
@@ -927,4 +940,27 @@
     (selection, &fsuiCallDownloadCallback, &GNUNET_FSUI_download_stop);
 }
 
+
+/**
+ * Right-click on an active download
+ */
+gboolean
+on_activeDownloadsList_button_press_fs (GtkWidget * treeview,
+                                        GdkEventButton * event_button,
+                                        gpointer dummy)
+{
+  GtkWidget *menu;
+  GladeXML *contextMenuXML;
+
+  contextMenuXML =
+    glade_xml_new (GNUNET_GTK_get_glade_filename (),
+                   "downloadsContextMenu", PACKAGE_NAME);
+  GNUNET_GTK_connect_glade_with_plugins (contextMenuXML);
+  menu = glade_xml_get_widget (contextMenuXML, "downloadsContextMenu");
+  if (event_button->button == 3)
+    gtk_menu_popup (GTK_MENU(menu),
+                    NULL, NULL, NULL, NULL,
+                    event_button->button, event_button->time);
+  return FALSE;
+}
 /* end of download.c */

Modified: gnunet-gtk/src/plugins/fs/fs.c
===================================================================
--- gnunet-gtk/src/plugins/fs/fs.c      2008-06-09 16:34:31 UTC (rev 7110)
+++ gnunet-gtk/src/plugins/fs/fs.c      2008-06-09 17:54:20 UTC (rev 7111)
@@ -358,10 +358,12 @@
                             > 0);
 }
 
-static int
-on_upload_copy_uri_activate (void *cls, GtkWidget * searchEntry)
+int
+on_upload_copy_uri_activate_fs (void *dummy1, GtkWidget *dummy2)
 {
-  GtkTreeView *uploadList = cls;
+  GtkWidget *uploadsList =
+    glade_xml_get_widget (GNUNET_GTK_get_main_glade_XML (),
+                          "activeUploadsList");
   GtkTreePath *path;
   GtkTreeIter iter;
   struct GNUNET_ECRS_URI *uri;
@@ -369,7 +371,7 @@
   GtkClipboard *clip;
 
   path = NULL;
-  if (FALSE == gtk_tree_view_get_path_at_pos (uploadList,
+  if (FALSE == gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW(uploadsList),
                                               last_x,
                                               last_y,
                                               &path, NULL, NULL, NULL))
@@ -394,37 +396,6 @@
   return FALSE;
 }
 
-static gint
-upload_click_handler (void *cls, GdkEvent * event)
-{
-  GtkTreeView *uploadList = cls;
-  GtkMenu *menu;
-  GtkWidget *entry;
-  GdkEventButton *event_button;
-
-  if ((event == NULL) || (event->type != GDK_BUTTON_PRESS))
-    return FALSE;
-  event_button = (GdkEventButton *) event;
-  if (event_button->button != 3)
-    return FALSE;
-  last_x = event_button->x;
-  last_y = event_button->y;
-  entry = gtk_menu_item_new_with_label (_("_Copy URI to Clipboard"));
-  g_signal_connect_swapped (entry,
-                            "activate",
-                            G_CALLBACK (on_upload_copy_uri_activate),
-                            uploadList);
-  gtk_label_set_use_underline (GTK_LABEL
-                               (gtk_bin_get_child (GTK_BIN (entry))), TRUE);
-  gtk_widget_show (entry);
-  menu = GTK_MENU (gtk_menu_new ());
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), entry);
-  gtk_menu_popup (menu,
-                  NULL,
-                  NULL, NULL, NULL, event_button->button, event_button->time);
-  return TRUE;
-}
-
 /**
  * Setup the summary views (in particular the models
  * and the renderers).
@@ -441,6 +412,7 @@
   GtkCellRenderer *renderer;
   GtkTreeViewColumn *column;
   int col;
+  GladeXML *contextMenuXML;
 
   /* keyword list setup */
   searchCB
@@ -530,6 +502,10 @@
                          "changed",
                          G_CALLBACK (&on_download_summary_selection_changed),
                          NULL, NULL, 0);
+  contextMenuXML =
+    glade_xml_new (GNUNET_GTK_get_glade_filename (),
+                   "downloadsContextMenu", PACKAGE_NAME);
+  GNUNET_GTK_connect_glade_with_plugins (contextMenuXML);
 
   renderer = gtk_cell_renderer_text_new ();
   col = gtk_tree_view_insert_column_with_attributes (downloadList,
@@ -597,8 +573,6 @@
   uploadList =
     GTK_TREE_VIEW (glade_xml_get_widget
                    (GNUNET_GTK_get_main_glade_XML (), "activeUploadsList"));
-  g_signal_connect_swapped (uploadList, "button-press-event",
-                            G_CALLBACK (upload_click_handler), uploadList);
   upload_summary = gtk_tree_store_new (UPLOAD_NUM, G_TYPE_STRING,       /* 
filename */
                                        G_TYPE_INT,      /* progress */
                                        G_TYPE_STRING,   /* URI as string */
@@ -610,6 +584,10 @@
                          "changed",
                          G_CALLBACK (&on_upload_summary_selection_changed),
                          NULL, NULL, 0);
+  contextMenuXML =
+    glade_xml_new (GNUNET_GTK_get_glade_filename (),
+                   "uploadsContextMenu", PACKAGE_NAME);
+  GNUNET_GTK_connect_glade_with_plugins (contextMenuXML);
 
   renderer = gtk_cell_renderer_progress_new ();
   col = gtk_tree_view_insert_column_with_attributes (uploadList,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]