gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r20262 - in gnunet-gtk: contrib src/fs


From: gnunet
Subject: [GNUnet-SVN] r20262 - in gnunet-gtk: contrib src/fs
Date: Mon, 5 Mar 2012 01:36:22 +0100

Author: grothoff
Date: 2012-03-05 01:36:22 +0100 (Mon, 05 Mar 2012)
New Revision: 20262

Modified:
   gnunet-gtk/contrib/gnunet_fs_gtk_main_window.glade
   gnunet-gtk/contrib/gnunet_fs_gtk_search_tab.glade
   gnunet-gtk/src/fs/gnunet-fs-gtk.c
   gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c
Log:
-fixing various bugs, including signal handler signatures, also finally 
enabling probes #2150

Modified: gnunet-gtk/contrib/gnunet_fs_gtk_main_window.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_fs_gtk_main_window.glade  2012-03-05 00:18:35 UTC 
(rev 20261)
+++ gnunet-gtk/contrib/gnunet_fs_gtk_main_window.glade  2012-03-05 00:36:22 UTC 
(rev 20262)
@@ -161,7 +161,9 @@
     <property name="default_width">700</property>
     <property name="default_height">500</property>
     <property name="icon_name">gnunet-gtk</property>
-    <signal name="delete_event" handler="GNUNET_GTK_quit_cb" after="yes"/>
+    <signal name="size_request" 
handler="GNUNET_FS_GTK_main_window_size_request"/>
+    <signal name="drag_end" handler="GNUNET_FS_GTK_main_window_drag_end"/>
+    <signal name="delete_event" handler="GNUNET_FS_GTK_delete_event_cb" 
after="yes"/>
     <child>
       <object class="GtkVBox" id="GNUNET_GTK_main_window_vbox">
         <property name="visible">True</property>
@@ -271,7 +273,7 @@
                         <property name="use_underline">True</property>
                         <property name="use_stock">True</property>
                         <accelerator key="q" signal="activate" 
modifiers="GDK_CONTROL_MASK"/>
-                        <signal name="activate" handler="GNUNET_GTK_quit_cb"/>
+                        <signal name="activate" 
handler="GNUNET_FS_GTK_menu_quit_activate_cb"/>
                       </object>
                     </child>
                   </object>
@@ -813,8 +815,6 @@
             </child>
           </object>
           <packing>
-            <property name="expand">True</property>
-            <property name="fill">True</property>
             <property name="position">0</property>
           </packing>
         </child>
@@ -851,9 +851,9 @@
   <object class="GtkSizeGroup" id="enties_and_comboboxes_sizegroup">
     <property name="mode">vertical</property>
     <widgets>
+      <widget name="main_window_search_entry"/>
+      <widget name="main_window_search_anonymity_combobox"/>
       <widget name="main_window_search_mime_combobox"/>
-      <widget name="main_window_search_anonymity_combobox"/>
-      <widget name="main_window_search_entry"/>
     </widgets>
   </object>
   <object class="GtkAdjustment" id="expiration_year_adjustment">

Modified: gnunet-gtk/contrib/gnunet_fs_gtk_search_tab.glade
===================================================================
--- gnunet-gtk/contrib/gnunet_fs_gtk_search_tab.glade   2012-03-05 00:18:35 UTC 
(rev 20261)
+++ gnunet-gtk/contrib/gnunet_fs_gtk_search_tab.glade   2012-03-05 00:36:22 UTC 
(rev 20262)
@@ -88,7 +88,7 @@
               <object class="GtkTreeViewColumn" 
id="search_result_availability_column">
                 <property name="title">Availability</property>
                 <property name="clickable">True</property>
-                <property name="visible">False</property>
+                <property name="visible">True</property>
                 <property name="reorderable">True</property>
                 <property name="sort_indicator">True</property>
                 <property name="sort_column_id">5</property>

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk.c   2012-03-05 00:18:35 UTC (rev 20261)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk.c   2012-03-05 00:36:22 UTC (rev 20262)
@@ -110,7 +110,7 @@
  *
  * @param main_window main window widget
  */
-static void
+void
 main_window_save_position (GtkWidget *main_window)
 {
   GdkWindow *main_window_gdk;
@@ -157,6 +157,40 @@
 
 
 /**
+ * Obtains main window position and size before it's destroyed
+ * and saves these into user's config file.
+ *
+ * @param main_window main window widget
+ */
+void
+GNUNET_FS_GTK_main_window_drag_end (GtkWidget *main_window,
+                                   GdkDragContext *drag_context,
+                                   gpointer user_data)
+{
+  struct GNUNET_GTK_MainWindowContext *main_context = user_data;
+
+  main_window_save_position (main_context->main_window);
+}
+
+
+/**
+ * Obtains main window position and size before it's destroyed
+ * and saves these into user's config file.
+ *
+ * @param main_window main window widget
+ */
+void
+GNUNET_FS_GTK_main_window_size_request (GtkWidget *main_window,
+                                       GtkRequisition *requisition,
+                                       gpointer user_data)
+{
+  struct GNUNET_GTK_MainWindowContext *main_context = user_data;
+
+  main_window_save_position (main_context->main_window);
+}
+
+
+/**
  * Task run on shutdown.
  * FIXME-STYLE: does this need to be a separate task!?
  *
@@ -182,12 +216,31 @@
  * @param user_data global builder instance, unused
  */
 void
-GNUNET_GTK_quit_cb (GObject * object, gpointer user_data)
+GNUNET_FS_GTK_menu_quit_activate_cb (GtkMenuItem *object,
+                                 gpointer user_data)
 {
   struct GNUNET_GTK_MainWindowContext *main_context = user_data;
 
-  main_window_save_position (main_context->main_window);
+  GNUNET_GTK_tray_icon_destroy ();
+  GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE,
+                                      &shutdown_task, NULL);
+  GNUNET_free (main_context);
+}
 
+
+/**
+ * Callback invoked if the application is supposed to exit.
+ *
+ * @param object origin of the quit event, unused
+ * @param user_data global builder instance, unused
+ */
+void
+GNUNET_FS_GTK_delete_event_cb (GtkWidget *object,
+                           GdkEvent *event,
+                           gpointer user_data)
+{
+  struct GNUNET_GTK_MainWindowContext *main_context = user_data;
+
   GNUNET_GTK_tray_icon_destroy ();
   GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE,
                                       &shutdown_task, NULL);
@@ -208,20 +261,16 @@
   unsigned long long dl_parallel, req_parallel, window_x, window_y,
       window_width, window_height;
   int maximized;
-
   struct GNUNET_GTK_MainWindowContext *main_context;
 
   main_context = GNUNET_malloc (sizeof (struct GNUNET_GTK_MainWindowContext));
-
   ml = cls;
-
   /* setup main context */
   if (GNUNET_OK != GNUNET_GTK_main_loop_build_window (cls, main_context))
   {
     GNUNET_free (main_context);
     return;
   }
-
   main_context->builder = GNUNET_GTK_main_loop_get_builder (cls);
   main_context->cfg = GNUNET_GTK_main_loop_get_configuration (cls);
   main_context->search_ns_treestore = GTK_TREE_STORE 
(GNUNET_FS_GTK_get_main_window_object 
("main_window_search_namespace_treestore"));
@@ -297,8 +346,7 @@
   /* initialize file-sharing */
   fs = GNUNET_FS_start (main_context->cfg, "gnunet-fs-gtk",
                        &GNUNET_GTK_fs_event_handler, NULL, 
-                       GNUNET_FS_FLAGS_NONE | GNUNET_FS_FLAGS_PERSISTENCE 
-                                                /* | GNUNET_FS_FLAGS_DO_PROBES 
*/ ,
+                       GNUNET_FS_FLAGS_PERSISTENCE | GNUNET_FS_FLAGS_DO_PROBES,
                         GNUNET_FS_OPTIONS_DOWNLOAD_PARALLELISM,
                         (unsigned int) dl_parallel,
                         GNUNET_FS_OPTIONS_REQUEST_PARALLELISM,

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c     2012-03-05 00:18:35 UTC 
(rev 20261)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk_event-handler.c     2012-03-05 00:36:22 UTC 
(rev 20262)
@@ -1440,9 +1440,9 @@
 static void
 update_search_result (struct SearchResult *sr,
                       const struct GNUNET_CONTAINER_MetaData *meta,
-                      int32_t availability_rank,
-                      uint32_t availability_certainty,
-                      uint32_t applicability_rank)
+                      uint32_t applicability_rank,
+                     int32_t availability_rank,
+                      uint32_t availability_certainty)
 {
   GtkTreeIter iter;
   struct GNUNET_CONTAINER_MetaData *ometa;
@@ -1479,11 +1479,9 @@
   if (NULL != ometa)
     GNUNET_CONTAINER_meta_data_destroy (ometa);
   if (availability_certainty > 0)
-    percent_avail =
-        (availability_certainty +
-         availability_rank) * 50 / availability_certainty;
+    percent_avail = 50 + (2 * availability_rank - availability_certainty) * 50 
/ availability_certainty;
   else
-    percent_avail = 0;
+    percent_avail = 50;
   gtk_tree_store_set (ts, &iter, 
                      0, GNUNET_CONTAINER_meta_data_duplicate (meta),
                       3, pixbuf /* preview */ ,




reply via email to

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