gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r13465 - in gnunet-gtk: . contrib src


From: gnunet
Subject: [GNUnet-SVN] r13465 - in gnunet-gtk: . contrib src
Date: Fri, 29 Oct 2010 16:40:51 +0200

Author: grothoff
Date: 2010-10-29 16:40:51 +0200 (Fri, 29 Oct 2010)
New Revision: 13465

Modified:
   gnunet-gtk/configure.ac
   gnunet-gtk/contrib/Makefile.in
   gnunet-gtk/contrib/advertise_pseudonym_dialog.glade
   gnunet-gtk/contrib/publish-directory-dialog.glade
   gnunet-gtk/contrib/publish-file-dialog.glade
   gnunet-gtk/contrib/publish_edit_dialog.glade
   gnunet-gtk/gnunet_gtk_config.h.in
   gnunet-gtk/ltmain.sh
   gnunet-gtk/src/common.c
   gnunet-gtk/src/common.h
   gnunet-gtk/src/edit_publish_dialog.c
   gnunet-gtk/src/main_window_adv_pseudonym.c
   gnunet-gtk/src/main_window_file_publish.c
Log:
enable setting of expiration times

Modified: gnunet-gtk/configure.ac
===================================================================
--- gnunet-gtk/configure.ac     2010-10-29 14:21:43 UTC (rev 13464)
+++ gnunet-gtk/configure.ac     2010-10-29 14:40:51 UTC (rev 13465)
@@ -152,7 +152,10 @@
  AC_MSG_ERROR(Cannot find GTK: Is gtk-config in path?)
 fi
 
+AC_CHECK_HEADERS([glib.h gmodule.h gtk/gtk.h])
 
+
+
 # test for Glade
 glade=0
 AC_MSG_CHECKING(for Glade core)

Modified: gnunet-gtk/contrib/Makefile.in
===================================================================
--- gnunet-gtk/contrib/Makefile.in      2010-10-29 14:21:43 UTC (rev 13464)
+++ gnunet-gtk/contrib/Makefile.in      2010-10-29 14:40:51 UTC (rev 13465)
@@ -157,7 +157,6 @@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
 INTLLIBS = @INTLLIBS@
-INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
 LIBICONV = @LIBICONV@

Modified: gnunet-gtk/contrib/advertise_pseudonym_dialog.glade
===================================================================
--- gnunet-gtk/contrib/advertise_pseudonym_dialog.glade 2010-10-29 14:21:43 UTC 
(rev 13464)
+++ gnunet-gtk/contrib/advertise_pseudonym_dialog.glade 2010-10-29 14:40:51 UTC 
(rev 13465)
@@ -2,52 +2,29 @@
 <interface>
   <requires lib="gtk+" version="2.20"/>
   <!-- interface-naming-policy project-wide -->
-  <object class="GtkAdjustment" id="adjustment4">
-    <property name="upper">100</property>
+  <object class="GtkAdjustment" id="expiration_year_adjustment">
+    <property name="upper">9999</property>
     <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-    <property name="page_size">10</property>
+    <property name="page_increment">5</property>
   </object>
-  <object class="GtkAdjustment" id="adjustment3">
-    <property name="upper">100</property>
+  <object class="GtkAdjustment" id="priority_adjustment">
+    <property name="upper">10000000</property>
+    <property name="value">1000</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
-    <property name="page_size">10</property>
   </object>
-  <object class="GtkAdjustment" id="adjustment2">
-    <property name="upper">100</property>
+  <object class="GtkAdjustment" id="GNUNET_GTK_anonymity_adjustment">
+    <property name="upper">100000</property>
+    <property name="value">1</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
-    <property name="page_size">10</property>
   </object>
-  <object class="GtkAdjustment" id="adjustment1">
-    <property name="upper">100</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-    <property name="page_size">10</property>
-  </object>
-  <object class="GtkListStore" id="GNUNET_GTK_metatype_list_store">
+  <object class="GtkListStore" id="GNUNET_GTK_keyword_list_store">
     <columns>
-      <!-- column-name description -->
+      <!-- column-name keyword -->
       <column type="gchararray"/>
-      <!-- column-name guint1 -->
-      <column type="guint"/>
-      <!-- column-name helptext -->
-      <column type="gchararray"/>
     </columns>
   </object>
-  <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store">
-    <columns>
-      <!-- column-name extractor_meta_type -->
-      <column type="guint"/>
-      <!-- column-name extractor_meta_format -->
-      <column type="guint"/>
-      <!-- column-name extractor_meta_type_string -->
-      <column type="gchararray"/>
-      <!-- column-name extracotr_meta_value -->
-      <column type="gchararray"/>
-    </columns>
-  </object>
   <object class="GtkDialog" id="GNUNET_GTK_advertise_pseudonym_dialog">
     <property name="border_width">5</property>
     <property name="title" translatable="yes">Advertise namespace</property>
@@ -513,7 +490,6 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="padding">10</property>
                     <property name="position">3</property>
                   </packing>
                 </child>
@@ -697,27 +673,50 @@
       <action-widget 
response="-5">GNUNET_GTK_advertise_pseudonym_confirm_button</action-widget>
     </action-widgets>
   </object>
-  <object class="GtkListStore" id="GNUNET_GTK_keyword_list_store">
+  <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store">
     <columns>
-      <!-- column-name keyword -->
+      <!-- column-name extractor_meta_type -->
+      <column type="guint"/>
+      <!-- column-name extractor_meta_format -->
+      <column type="guint"/>
+      <!-- column-name extractor_meta_type_string -->
       <column type="gchararray"/>
+      <!-- column-name extracotr_meta_value -->
+      <column type="gchararray"/>
     </columns>
   </object>
-  <object class="GtkAdjustment" id="GNUNET_GTK_anonymity_adjustment">
-    <property name="upper">100000</property>
-    <property name="value">1</property>
+  <object class="GtkListStore" id="GNUNET_GTK_metatype_list_store">
+    <columns>
+      <!-- column-name description -->
+      <column type="gchararray"/>
+      <!-- column-name guint1 -->
+      <column type="guint"/>
+      <!-- column-name helptext -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="upper">100</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
+    <property name="page_size">10</property>
   </object>
-  <object class="GtkAdjustment" id="priority_adjustment">
-    <property name="upper">10000000</property>
-    <property name="value">1000</property>
+  <object class="GtkAdjustment" id="adjustment2">
+    <property name="upper">100</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
+    <property name="page_size">10</property>
   </object>
-  <object class="GtkAdjustment" id="expiration_year_adjustment">
-    <property name="upper">9999</property>
+  <object class="GtkAdjustment" id="adjustment3">
+    <property name="upper">100</property>
     <property name="step_increment">1</property>
-    <property name="page_increment">5</property>
+    <property name="page_increment">10</property>
+    <property name="page_size">10</property>
   </object>
+  <object class="GtkAdjustment" id="adjustment4">
+    <property name="upper">100</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+    <property name="page_size">10</property>
+  </object>
 </interface>

Modified: gnunet-gtk/contrib/publish-directory-dialog.glade
===================================================================
--- gnunet-gtk/contrib/publish-directory-dialog.glade   2010-10-29 14:21:43 UTC 
(rev 13464)
+++ gnunet-gtk/contrib/publish-directory-dialog.glade   2010-10-29 14:40:51 UTC 
(rev 13465)
@@ -108,13 +108,15 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkSpinButton" 
id="GNUNET_GTK_publish_directory_dialog_expiration_year">
+                  <object class="GtkSpinButton" 
id="GNUNET_GTK_publish_directory_dialog_expiration_year_spin_button">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="invisible_char">•</property>
                     <property 
name="adjustment">expiration_year_adjustment</property>
                   </object>
                   <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
                     <property name="position">1</property>
                   </packing>
                 </child>

Modified: gnunet-gtk/contrib/publish-file-dialog.glade
===================================================================
--- gnunet-gtk/contrib/publish-file-dialog.glade        2010-10-29 14:21:43 UTC 
(rev 13464)
+++ gnunet-gtk/contrib/publish-file-dialog.glade        2010-10-29 14:40:51 UTC 
(rev 13465)
@@ -2,39 +2,14 @@
 <interface>
   <requires lib="gtk+" version="2.20"/>
   <!-- interface-naming-policy project-wide -->
-  <object class="GtkAdjustment" id="expiration_year_adjustment">
-    <property name="upper">9999</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkAdjustment" id="anonymity_adjustment">
-    <property name="upper">10000000</property>
-    <property name="value">1</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
-  <object class="GtkListStore" 
id="GNUNET_GTK_publish_file_dialog_expiration_list_store">
-    <columns>
-      <!-- column-name human_readable_time -->
-      <column type="gchararray"/>
-      <!-- column-name time_in_ms -->
-      <column type="guint64"/>
-    </columns>
-  </object>
-  <object class="GtkAdjustment" id="priority_adjustment">
-    <property name="upper">100000000</property>
-    <property name="value">1000</property>
-    <property name="step_increment">1</property>
-    <property name="page_increment">10</property>
-  </object>
   <object class="GtkFileChooserDialog" id="GNUNET_GTK_publish_file_dialog">
     <property name="can_default">True</property>
     <property name="border_width">5</property>
     <property name="title" translatable="yes">Publish file...</property>
     <property name="type_hint">normal</property>
     <property name="has_separator">False</property>
+    <property name="select_multiple">True</property>
     <property name="create_folders">False</property>
-    <property name="select_multiple">True</property>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox1">
         <property name="visible">True</property>
@@ -122,6 +97,8 @@
                     <property name="numeric">True</property>
                   </object>
                   <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
@@ -211,4 +188,29 @@
       <action-widget 
response="-5">GNUNET_GTK_publish_file_dialog_ok_button</action-widget>
     </action-widgets>
   </object>
+  <object class="GtkAdjustment" id="priority_adjustment">
+    <property name="upper">100000000</property>
+    <property name="value">1000</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkListStore" 
id="GNUNET_GTK_publish_file_dialog_expiration_list_store">
+    <columns>
+      <!-- column-name human_readable_time -->
+      <column type="gchararray"/>
+      <!-- column-name time_in_ms -->
+      <column type="guint64"/>
+    </columns>
+  </object>
+  <object class="GtkAdjustment" id="anonymity_adjustment">
+    <property name="upper">10000000</property>
+    <property name="value">1</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="expiration_year_adjustment">
+    <property name="upper">9999</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
 </interface>

Modified: gnunet-gtk/contrib/publish_edit_dialog.glade
===================================================================
--- gnunet-gtk/contrib/publish_edit_dialog.glade        2010-10-29 14:21:43 UTC 
(rev 13464)
+++ gnunet-gtk/contrib/publish_edit_dialog.glade        2010-10-29 14:40:51 UTC 
(rev 13465)
@@ -2,38 +2,27 @@
 <interface>
   <requires lib="gtk+" version="2.20"/>
   <!-- interface-naming-policy project-wide -->
-  <object class="GtkAdjustment" id="adjustment2">
-    <property name="upper">100</property>
+  <object class="GtkAdjustment" id="expiration_year_adjustment">
+    <property name="upper">9999</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
-    <property name="page_size">10</property>
   </object>
-  <object class="GtkAdjustment" id="adjustment1">
-    <property name="upper">100</property>
+  <object class="GtkAdjustment" id="priority_adjustment">
+    <property name="upper">10000000</property>
+    <property name="value">1000</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
-    <property name="page_size">10</property>
   </object>
-  <object class="GtkListStore" id="GNUNET_GTK_metatype_list_store">
-    <columns>
-      <!-- column-name description -->
-      <column type="gchararray"/>
-      <!-- column-name guint1 -->
-      <column type="guint"/>
-      <!-- column-name helptext -->
-      <column type="gchararray"/>
-    </columns>
+  <object class="GtkAdjustment" id="GNUNET_GTK_anonymity_adjustment">
+    <property name="upper">100000</property>
+    <property name="value">1</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
   </object>
-  <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store">
+  <object class="GtkListStore" id="GNUNET_GTK_keyword_list_store">
     <columns>
-      <!-- column-name extractor_meta_type -->
-      <column type="guint"/>
-      <!-- column-name extractor_meta_format -->
-      <column type="guint"/>
-      <!-- column-name extractor_meta_type_string -->
+      <!-- column-name keyword -->
       <column type="gchararray"/>
-      <!-- column-name extracotr_meta_value -->
-      <column type="gchararray"/>
     </columns>
   </object>
   <object class="GtkDialog" id="GNUNET_GTK_edit_file_information_dialog">
@@ -449,7 +438,6 @@
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="padding">5</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
@@ -496,7 +484,6 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="padding">10</property>
                     <property name="position">3</property>
                   </packing>
                 </child>
@@ -542,7 +529,6 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="padding">10</property>
                     <property name="position">5</property>
                   </packing>
                 </child>
@@ -615,7 +601,7 @@
                         <property name="max_length">4</property>
                         <property name="invisible_char">•</property>
                         <property name="invisible_char_set">True</property>
-                        <property 
name="adjustment">GNUNET_GTK_year_adjustment</property>
+                        <property 
name="adjustment">expiration_year_adjustment</property>
                         <property name="climb_rate">1</property>
                         <property name="numeric">True</property>
                       </object>
@@ -625,6 +611,8 @@
                     </child>
                   </object>
                   <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
                     <property name="position">8</property>
                   </packing>
                 </child>
@@ -690,22 +678,38 @@
       <action-widget 
response="-5">GNUNET_GTK_edit_file_information_confirm_button</action-widget>
     </action-widgets>
   </object>
-  <object class="GtkListStore" id="GNUNET_GTK_keyword_list_store">
+  <object class="GtkListStore" id="GNUNET_GTK_meta_data_list_store">
     <columns>
-      <!-- column-name keyword -->
+      <!-- column-name extractor_meta_type -->
+      <column type="guint"/>
+      <!-- column-name extractor_meta_format -->
+      <column type="guint"/>
+      <!-- column-name extractor_meta_type_string -->
       <column type="gchararray"/>
+      <!-- column-name extracotr_meta_value -->
+      <column type="gchararray"/>
     </columns>
   </object>
-  <object class="GtkAdjustment" id="GNUNET_GTK_anonymity_adjustment">
-    <property name="upper">100000</property>
-    <property name="value">1</property>
+  <object class="GtkListStore" id="GNUNET_GTK_metatype_list_store">
+    <columns>
+      <!-- column-name description -->
+      <column type="gchararray"/>
+      <!-- column-name guint1 -->
+      <column type="guint"/>
+      <!-- column-name helptext -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkAdjustment" id="adjustment1">
+    <property name="upper">100</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
+    <property name="page_size">10</property>
   </object>
-  <object class="GtkAdjustment" id="priority_adjustment">
-    <property name="upper">10000000</property>
-    <property name="value">1000</property>
+  <object class="GtkAdjustment" id="adjustment2">
+    <property name="upper">100</property>
     <property name="step_increment">1</property>
     <property name="page_increment">10</property>
+    <property name="page_size">10</property>
   </object>
 </interface>

Modified: gnunet-gtk/gnunet_gtk_config.h.in
===================================================================
--- gnunet-gtk/gnunet_gtk_config.h.in   2010-10-29 14:21:43 UTC (rev 13464)
+++ gnunet-gtk/gnunet_gtk_config.h.in   2010-10-29 14:40:51 UTC (rev 13465)
@@ -15,14 +15,6 @@
 /* Define to 1 if you have the <argz.h> header file. */
 #undef HAVE_ARGZ_H
 
-/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
-   CoreFoundation framework. */
-#undef HAVE_CFLOCALECOPYCURRENT
-
-/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
-   the CoreFoundation framework. */
-#undef HAVE_CFPREFERENCESCOPYAPPVALUE
-
 /* Define if the GNU dcgettext() function is already present or preinstalled.
    */
 #undef HAVE_DCGETTEXT
@@ -45,6 +37,12 @@
 /* Define to 1 if you have the <gladeui/glade.h> header file. */
 #undef HAVE_GLADEUI_GLADE_H
 
+/* Define to 1 if you have the <glib.h> header file. */
+#undef HAVE_GLIB_H
+
+/* Define to 1 if you have the <gmodule.h> header file. */
+#undef HAVE_GMODULE_H
+
 /* Define to 1 if you have the <gnunet/gnunet_core_service.h> header file. */
 #undef HAVE_GNUNET_GNUNET_CORE_SERVICE_H
 
@@ -64,6 +62,9 @@
 /* We have GTK */
 #undef HAVE_GTK
 
+/* Define to 1 if you have the <gtk/gtk.h> header file. */
+#undef HAVE_GTK_GTK_H
+
 /* Define if you have the iconv() function and it works. */
 #undef HAVE_ICONV
 
@@ -104,6 +105,9 @@
 /* Define to 1 if you have the <netinet/in.h> header file. */
 #undef HAVE_NETINET_IN_H
 
+/* Define to 1 if you have the <stdarg.h> header file. */
+#undef HAVE_STDARG_H
+
 /* Define to 1 if you have the <stddef.h> header file. */
 #undef HAVE_STDDEF_H
 

Modified: gnunet-gtk/ltmain.sh
===================================================================
--- gnunet-gtk/ltmain.sh        2010-10-29 14:21:43 UTC (rev 13464)
+++ gnunet-gtk/ltmain.sh        2010-10-29 14:40:51 UTC (rev 13465)
@@ -65,7 +65,7 @@
 #       compiler:              $LTCC
 #       compiler flags:                $LTCFLAGS
 #       linker:                $LD (gnu? $with_gnu_ld)
-#       $progname:             (GNU libtool) 2.2.6b Debian-2.2.6b-2
+#       $progname:             (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1
 #       automake:              $automake_version
 #       autoconf:              $autoconf_version
 #
@@ -73,7 +73,7 @@
 
 PROGRAM=ltmain.sh
 PACKAGE=libtool
-VERSION="2.2.6b Debian-2.2.6b-2"
+VERSION="2.2.6b Debian-2.2.6b-2ubuntu1"
 TIMESTAMP=""
 package_revision=1.3017
 

Modified: gnunet-gtk/src/common.c
===================================================================
--- gnunet-gtk/src/common.c     2010-10-29 14:21:43 UTC (rev 13464)
+++ gnunet-gtk/src/common.c     2010-10-29 14:40:51 UTC (rev 13465)
@@ -65,6 +65,51 @@
   return 0;
 }
 
+
+/**
+ * Convert the year from the spin button to an expiration
+ * time (on midnight, January 1st of that year).
+ */
+struct GNUNET_TIME_Absolute 
+GNUNET_GTK_get_expiration_time (GtkSpinButton *spin)
+{
+  struct GNUNET_TIME_Absolute ret;
+  int year;
+  time_t tp;
+  struct tm t;
+
+  year = gtk_spin_button_get_value_as_int (spin);
+  memset (&t, 0, sizeof (t));
+  if (year < 1900)
+    return GNUNET_TIME_absolute_get (); /* now */
+  t.tm_year = year - 1900;
+  tp = mktime (&t);
+  ret.abs_value = tp * 1000; /* seconds to ms */
+  return ret;
+}
+
+
+void
+GNUNET_GTK_setup_expiration_year_adjustment (GtkBuilder *builder)
+{
+  GtkAdjustment *aj;
+  struct tm *t;
+  int year;
+  time_t tp;
+
+  tp = time (NULL);
+  t = gmtime (&tp);
+  if (t == NULL)
+    year = 0;
+  else
+    year = t->tm_year + 1900;
+  aj = GTK_ADJUSTMENT (gtk_builder_get_object (builder,
+                                              "expiration_year_adjustment"));
+  gtk_adjustment_set_value (aj, year + 2);
+  gtk_adjustment_set_lower (aj, year + 1);
+}
+
+
 GdkPixbuf *
 GNUNET_GTK_get_thumbnail_from_meta_data (const struct 
GNUNET_CONTAINER_MetaData *meta)
 {

Modified: gnunet-gtk/src/common.h
===================================================================
--- gnunet-gtk/src/common.h     2010-10-29 14:21:43 UTC (rev 13464)
+++ gnunet-gtk/src/common.h     2010-10-29 14:40:51 UTC (rev 13465)
@@ -60,8 +60,22 @@
 GdkPixbuf *
 GNUNET_GTK_get_thumbnail_from_meta_data (const struct 
GNUNET_CONTAINER_MetaData *meta);
 
+/**
+ * Setup the expiration year adjustment to start with the
+ * next year and default to next year plus one.
+ */
+void
+GNUNET_GTK_setup_expiration_year_adjustment (GtkBuilder *builder);
 
 /**
+ * Convert the year from the spin button to an expiration
+ * time (on midnight, January 1st of that year).
+ */
+struct GNUNET_TIME_Absolute 
+GNUNET_GTK_get_expiration_time (GtkSpinButton *spin);
+
+
+/**
  * mmap the given file and run the GNUNET_FS_directory_list_contents
  * function on it.
  */

Modified: gnunet-gtk/src/edit_publish_dialog.c
===================================================================
--- gnunet-gtk/src/edit_publish_dialog.c        2010-10-29 14:21:43 UTC (rev 
13464)
+++ gnunet-gtk/src/edit_publish_dialog.c        2010-10-29 14:40:51 UTC (rev 
13465)
@@ -542,13 +542,17 @@
   char *value;
   guint ntype;  
   guint nformat;
-
+  GtkSpinButton *sb;
+  
   *anonymity = gtk_spin_button_get_value (GTK_SPIN_BUTTON 
(gtk_builder_get_object (builder,
                                                                                
   "GNUNET_GTK_edit_file_information_anonymity_spin_button")));
   *priority = gtk_spin_button_get_value (GTK_SPIN_BUTTON 
(gtk_builder_get_object (builder,
                                                                                
  "GNUNET_GTK_edit_file_information_priority_spin_button")));
   *do_index = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON 
(gtk_builder_get_object (builder,
                                                                                
       "GNUNET_GTK_edit_file_information_index_check_button")));
+  sb =GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
+                                              
"GNUNET_GTK_edit_file_information_expiration_year_spin_button"));
+  *expirationTime = GNUNET_GTK_get_expiration_time (sb);
   /* update URI */
   if (NULL != (*uri))
     GNUNET_FS_uri_destroy (*uri);
@@ -645,6 +649,7 @@
       GNUNET_break (0);
       return;
     }
+  GNUNET_GTK_setup_expiration_year_adjustment (builder);
   if (GNUNET_FS_file_information_is_directory (fip))
     {
       /* indexing does not apply to directories */

Modified: gnunet-gtk/src/main_window_adv_pseudonym.c
===================================================================
--- gnunet-gtk/src/main_window_adv_pseudonym.c  2010-10-29 14:21:43 UTC (rev 
13464)
+++ gnunet-gtk/src/main_window_adv_pseudonym.c  2010-10-29 14:40:51 UTC (rev 
13465)
@@ -398,6 +398,7 @@
   GtkTreeIter iter;
   GtkTreeSelection *sel;
   GtkTreeModel *tm;
+  GtkSpinButton *sb;
   uint32_t anonymity_level;
   uint32_t priority;
   struct GNUNET_FS_Uri *nxt;
@@ -469,6 +470,7 @@
       GNUNET_break (0);
       return;
     }
+  GNUNET_GTK_setup_expiration_year_adjustment (builder);
   ad = GTK_WIDGET (gtk_builder_get_object (builder,
                                           
"GNUNET_GTK_advertise_pseudonym_dialog"));
   ls = GTK_LIST_STORE (gtk_builder_get_object (builder,
@@ -561,6 +563,10 @@
                                                                                
        "GNUNET_GTK_advertise_pseudonym_anonymity_spin_button")));
   priority = gtk_spin_button_get_value (GTK_SPIN_BUTTON 
(gtk_builder_get_object (builder,
                                                                                
 "GNUNET_GTK_advertise_pseudonym_priority_spin_button")));
+  sb = GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
+                                              
"GNUNET_GTK_advertise_pseudonym_expiration_year_spin_button"));
+  expiration = GNUNET_GTK_get_expiration_time (sb);
+
   expiration = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_YEARS);
   root = gtk_entry_get_text (GTK_ENTRY (gtk_builder_get_object (builder,
                                                                
"GNUNET_GTK_advertise_pseudonym_root_entry")));

Modified: gnunet-gtk/src/main_window_file_publish.c
===================================================================
--- gnunet-gtk/src/main_window_file_publish.c   2010-10-29 14:21:43 UTC (rev 
13464)
+++ gnunet-gtk/src/main_window_file_publish.c   2010-10-29 14:40:51 UTC (rev 
13465)
@@ -1359,24 +1359,6 @@
 }
 
 
-struct ListValue
-{
-  const char *text;
-  uint64_t value;
-};
-
-
-static struct ListValue list_values[] =
-  {
-    { gettext_noop ("1 year"), 1000LL * 60 * 60 * 24 * 365 },
-    { gettext_noop ("1 month"), 1000LL * 60 * 60 * 24 * 30 },
-    { gettext_noop ("1 day"), 1000LL * 60 * 60 * 24 },
-    { gettext_noop ("1 hour"), 1000LL * 60 * 60 },
-    { gettext_noop ("1 minute"), 1000LL * 60 },
-    { NULL, 0}
-  };
-
-
 void
 GNUNET_GTK_master_publish_dialog_add_button_clicked_cb (GtkWidget * dummy, 
                                                        gpointer data)
@@ -1386,12 +1368,9 @@
   char *filename;
   uint32_t anonymity;
   uint32_t priority;
-  struct GNUNET_TIME_Relative exp;
+  struct GNUNET_TIME_Absolute exp;
   int do_index;
-  GtkComboBox *cb;
-  GtkListStore *ls;
-  GtkTreeIter iter;
-  int i;
+  GtkSpinButton *sb;
 
   builder = GNUNET_GTK_get_new_builder ("publish-file-dialog.glade");
   if (builder == NULL)
@@ -1401,21 +1380,7 @@
     }
   ad = GTK_WIDGET (gtk_builder_get_object (builder,
                                           "GNUNET_GTK_publish_file_dialog"));
-  cb = GTK_COMBO_BOX (gtk_builder_get_object (builder,
-                                          
"GNUNET_GTK_publish_file_dialog_expiration_combo_box"));
-
-  ls = GTK_LIST_STORE (gtk_builder_get_object (builder,
-                                              
"GNUNET_GTK_publish_file_dialog_expiration_list_store"));
-  i = 0;
-  while (list_values[i].text != NULL)
-    {
-      gtk_list_store_insert_before (ls, &iter, NULL);
-      gtk_list_store_set (ls, &iter, 
-                         0, gettext (list_values[i].text), 
-                         1, list_values[i].value,
-                         -1);
-      i++;
-    }  
+  GNUNET_GTK_setup_expiration_year_adjustment (builder);
   if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad)))
     {
       gtk_widget_destroy (ad);
@@ -1429,11 +1394,12 @@
                                                                                
  "GNUNET_GTK_publish_file_dialog_priority_spin_button")));
   do_index = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON 
(gtk_builder_get_object (builder,
                                                                                
      "GNUNET_GTK_publish_file_dialog_do_index_checkbutton")));
-  gtk_combo_box_get_active_iter (cb, &iter);
-  gtk_tree_model_get (GTK_TREE_MODEL (ls), &iter, 1, &exp.rel_value, -1);
+  sb = GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
+                                               
"GNUNET_GTK_publish_file_dialog_expiration_year_spin_button"));
+  exp = GNUNET_GTK_get_expiration_time (sb);
   add_file_at_iter (filename, anonymity,
                    priority, 
-                   GNUNET_TIME_relative_to_absolute (exp), do_index, 
+                   exp, do_index, 
                    NULL);
   gtk_widget_destroy (ad);
   g_object_unref (G_OBJECT (builder));
@@ -1561,12 +1527,9 @@
   char *filename;
   uint32_t anonymity;
   uint32_t priority;
-  struct GNUNET_TIME_Relative exp;
+  struct GNUNET_TIME_Absolute exp;
   int do_index;
-  GtkComboBox *cb;
-  GtkListStore *ls;
-  GtkTreeIter iter;
-  int i;
+  GtkSpinButton *sb;
 
   builder = GNUNET_GTK_get_new_builder ("publish-directory-dialog.glade");
   if (builder == NULL)
@@ -1574,24 +1537,9 @@
       GNUNET_break (0);
       return;
     }
+  GNUNET_GTK_setup_expiration_year_adjustment (builder);
   ad = GTK_WIDGET (gtk_builder_get_object (builder,
                                           
"GNUNET_GTK_publish_directory_dialog"));
-  cb = GTK_COMBO_BOX (gtk_builder_get_object (builder,
-                                          
"GNUNET_GTK_publish_directory_dialog_expiration_combo_box"));
-
-  ls = GTK_LIST_STORE (gtk_builder_get_object (builder,
-                                              
"GNUNET_GTK_publish_directory_dialog_expiration_list_store"));
-  i = 0;
-  while (list_values[i].text != NULL)
-    {
-      gtk_list_store_insert_before (ls, &iter, NULL);
-      gtk_list_store_set (ls, &iter, 
-                         0, gettext (list_values[i].text), 
-                         1, list_values[i].value,
-                         -1);
-      i++;
-    }  
-
   if (GTK_RESPONSE_OK != gtk_dialog_run (GTK_DIALOG (ad)))
     {
       gtk_widget_destroy (ad);
@@ -1605,13 +1553,15 @@
                                                                                
  "GNUNET_GTK_publish_directory_dialog_priority_spin_button")));
   do_index = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON 
(gtk_builder_get_object (builder,
                                                                                
      "GNUNET_GTK_publish_directory_dialog_do_index_checkbutton")));
-  gtk_combo_box_get_active_iter (cb, &iter);
-  gtk_tree_model_get (GTK_TREE_MODEL (ls), &iter, 1, &exp.rel_value, -1);
+  sb = GTK_SPIN_BUTTON (gtk_builder_get_object (builder,
+                                          
"GNUNET_GTK_publish_directory_dialog_expiration_year_spin_button"));
+
+  exp = GNUNET_GTK_get_expiration_time (sb);
   gtk_widget_destroy (ad);
   g_object_unref (G_OBJECT (builder));
   /* FIXME: open progress dialog here... */
   add_dir (filename, anonymity, priority, 
-          GNUNET_TIME_relative_to_absolute (exp),
+          exp,
           do_index);
   g_free (filename);
   update_selectivity ();




reply via email to

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