gnunet-svn
[Top][All Lists]
Advanced

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

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


From: grothoff
Subject: [GNUnet-SVN] r3865 - in gnunet-gtk: . src/plugins/fs
Date: Sun, 3 Dec 2006 11:21:05 -0800 (PST)

Author: grothoff
Date: 2006-12-03 11:21:00 -0800 (Sun, 03 Dec 2006)
New Revision: 3865

Modified:
   gnunet-gtk/TODO
   gnunet-gtk/gnunet-gtk.glade
   gnunet-gtk/src/plugins/fs/search.c
   gnunet-gtk/src/plugins/fs/upload.c
Log:
towards nice buttons

Modified: gnunet-gtk/TODO
===================================================================
--- gnunet-gtk/TODO     2006-12-03 18:29:00 UTC (rev 3864)
+++ gnunet-gtk/TODO     2006-12-03 19:21:00 UTC (rev 3865)
@@ -1,5 +1,5 @@
 0.7.1:
-- disable inactive buttons (if no search/download 
+- disable inactive buttons in summary dialog (if no search/download 
   is selected to operate on) [ medium ] [pre1]
 - highlight active downloads in search list [ easy ] [pre1]
 - highlight completed downloads [ easy ] [pre1]

Modified: gnunet-gtk/gnunet-gtk.glade
===================================================================
--- gnunet-gtk/gnunet-gtk.glade 2006-12-03 18:29:00 UTC (rev 3864)
+++ gnunet-gtk/gnunet-gtk.glade 2006-12-03 19:21:00 UTC (rev 3865)
@@ -1585,6 +1585,7 @@
                              <property name="add_tearoffs">False</property>
                              <property name="has_frame">True</property>
                              <property name="focus_on_click">True</property>
+                             <signal name="changed" 
handler="on_fssearchKeywordComboBoxEntry_changed_" last_modification_time="Sun, 
03 Dec 2006 18:59:17 GMT"/>
                            </widget>
                          </child>
                        </widget>
@@ -1598,6 +1599,7 @@
                      <child>
                        <widget class="GtkButton" id="fssearchbutton">
                          <property name="visible">True</property>
+                         <property name="sensitive">False</property>
                          <property name="tooltip" translatable="yes">Search 
GNUnet for content under the specified keyword (and, if applicable, restrict 
the search to the given namespace)</property>
                          <property name="has_default">True</property>
                          <property name="can_focus">True</property>
@@ -2334,6 +2336,7 @@
                      <child>
                        <widget class="GtkButton" id="fsinsertuploadbutton">
                          <property name="visible">True</property>
+                         <property name="sensitive">False</property>
                          <property name="tooltip" translatable="yes">Share the 
specified file with the selected options (you will then be prompted to enter 
meta-data and keywords).</property>
                          <property name="can_focus">True</property>
                          <property name="relief">GTK_RELIEF_NORMAL</property>
@@ -2492,6 +2495,7 @@
                              <property name="add_tearoffs">False</property>
                              <property name="has_frame">True</property>
                              <property name="focus_on_click">True</property>
+                             <signal name="changed" 
handler="on_uploadFilenameComboBoxEntry_changed_" last_modification_time="Sun, 
03 Dec 2006 19:05:39 GMT"/>
                            </widget>
                          </child>
                        </widget>
@@ -4378,6 +4382,7 @@
                  <child>
                    <widget class="GtkButton" id="downloadButton">
                      <property name="visible">True</property>
+                     <property name="sensitive">False</property>
                      <property name="tooltip" translatable="yes">Download 
selected files.</property>
                      <property name="can_focus">True</property>
                      <property name="relief">GTK_RELIEF_NORMAL</property>

Modified: gnunet-gtk/src/plugins/fs/search.c
===================================================================
--- gnunet-gtk/src/plugins/fs/search.c  2006-12-03 18:29:00 UTC (rev 3864)
+++ gnunet-gtk/src/plugins/fs/search.c  2006-12-03 19:21:00 UTC (rev 3865)
@@ -34,6 +34,26 @@
 #include <GNUnet/gnunet_util_crypto.h>
 #include <GNUnet/gnunet_namespace_lib.h>
 
+
+/**
+ * The user has edited the search entry.
+ * Update search button status.
+ */
+static void on_fssearchSelectionChanged(gpointer signal,
+                                       gpointer cls) {
+  SearchList * list = cls;
+  GtkTreeSelection * selection;
+  GtkWidget * downloadButton;
+
+  selection = gtk_tree_view_get_selection(list->treeview);
+  downloadButton
+    = glade_xml_get_widget(list->searchXML,
+                          "downloadButton");
+  gtk_widget_set_sensitive(downloadButton,
+                          gtk_tree_selection_count_selected_rows(selection) > 
0);
+}
+
+
 /* **************** FSUI event handling ****************** */
 
 /**
@@ -221,6 +241,12 @@
   gtk_tree_selection_set_mode(gtk_tree_view_get_selection(list->treeview),
                              GTK_SELECTION_MULTIPLE);
 
+  g_signal_connect_data(gtk_tree_view_get_selection(list->treeview),
+                       "changed",
+                       G_CALLBACK(&on_fssearchSelectionChanged),
+                       list,
+                       NULL,
+                       0);
   renderer = gtk_cell_renderer_text_new();
   col = gtk_tree_view_insert_column_with_attributes(list->treeview,
                                                    -1,
@@ -462,6 +488,25 @@
 
 
 /**
+ * The user has edited the search entry.
+ * Update search button status.
+ */
+void on_fssearchKeywordComboBoxEntry_changed_fs(gpointer dummy2,
+                                               GtkWidget * searchEntry) {
+  const char * searchString;
+  GtkWidget * searchButton;
+
+  searchString = getEntryLineValue(getMainXML(),
+                                  "fssearchKeywordComboBoxEntry");
+  searchButton
+    = glade_xml_get_widget(getMainXML(),
+                          "fssearchbutton");
+  gtk_widget_set_sensitive(searchButton,
+                          strlen(searchString) > 0);
+}
+
+
+/**
  * The user has clicked the "SEARCH" button.
  * Initiate a search.
  */

Modified: gnunet-gtk/src/plugins/fs/upload.c
===================================================================
--- gnunet-gtk/src/plugins/fs/upload.c  2006-12-03 18:29:00 UTC (rev 3864)
+++ gnunet-gtk/src/plugins/fs/upload.c  2006-12-03 19:21:00 UTC (rev 3865)
@@ -442,6 +442,43 @@
   }
 }
 
+/**
+ * The user has edited the search entry.
+ * Update search button status.
+ */
+void on_uploadFilenameComboBoxEntry_changed_fs(gpointer dummy2,
+                                              GtkWidget * searchEntry) {
+  const char * filename;
+  GtkWidget * uploadButton;
+  struct stat buf;
+  int ok;
+  GtkWidget * toggle;
+
+  filename = getEntryLineValue(getMainXML(),
+                              "uploadFilenameComboBoxEntry");
+  ok = (0 == stat(filename, &buf));
+  if (ok)  
+    ok = (0 == ACCESS(filename, R_OK));
+  if (ok) {
+    if (S_ISDIR(buf.st_mode)) {
+      toggle = glade_xml_get_widget(getMainXML(),
+                                   "scopeRecursiveButton");
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
+                                  1);
+    } else {
+      toggle = glade_xml_get_widget(getMainXML(),
+                                   "scopeFileOnlyButton");
+      gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
+                                  1);
+    }
+  }
+  uploadButton
+    = glade_xml_get_widget(getMainXML(),
+                          "fsinsertuploadbutton");
+  gtk_widget_set_sensitive(uploadButton,
+                          ok);
+}
+
 void on_clearCompletedUploadsButton_clicked_fs(void * unused,
                                               GtkWidget * clearButton) {
   ggc_tree_model_foreach(GTK_TREE_MODEL(upload_summary),





reply via email to

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