summaryrefslogtreecommitdiff
path: root/src/gui/dialogs
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-10-26 09:18:15 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-10-26 09:18:15 (GMT)
commitd3039fda0302bb02a9df00425f8b06bce5185049 (patch)
tree2d4e65536011a8c51b2e021eee4fea8ebca2d239 /src/gui/dialogs
parenta9c607a1be25b43a17ea55b21459a0433f4f3d5b (diff)
Updated the storage dialog box.
Diffstat (limited to 'src/gui/dialogs')
-rw-r--r--src/gui/dialogs/storage.c18
-rw-r--r--src/gui/dialogs/storage.ui42
2 files changed, 37 insertions, 23 deletions
diff --git a/src/gui/dialogs/storage.c b/src/gui/dialogs/storage.c
index b66f0ab..60c0368 100644
--- a/src/gui/dialogs/storage.c
+++ b/src/gui/dialogs/storage.c
@@ -24,6 +24,11 @@
#include "storage.h"
+#include <malloc.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+
/* Colonnes de la liste des collections */
typedef enum _CollecFeatureColumn
@@ -68,7 +73,7 @@ GtkWidget *create_storage_dialog(GLoadedBinary *binary, GtkWindow *parent, GtkBu
GtkBuilder *builder; /* Constructeur utilisé */
GtkToggleButton *use_remote; /* Choix du serveur distant */
const char *host; /* Serveur distant à contacter */
- unsigned short port; /* Port d'écoute du serveur */
+ const char *port; /* Port d'écoute du serveur */
GObject *widget; /* Composant à mettre à jour */
GtkListStore *store; /* Modèle de gestion */
GDbCollection **collections; /* Ensemble de collections */
@@ -99,7 +104,7 @@ GtkWidget *create_storage_dialog(GLoadedBinary *binary, GtkWindow *parent, GtkBu
gtk_entry_set_text(GTK_ENTRY(widget), host);
widget = gtk_builder_get_object(builder, "port");
- gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), port);
+ gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), atoi(port));
on_server_use_toggled(use_remote, builder);
@@ -271,7 +276,8 @@ void update_binary_storage(GtkBuilder *builder, GLoadedBinary *binary)
{
GObject *widget; /* Composant à mettre à jour */
const gchar *host; /* Serveur distant à contacter */
- gint port; /* Port d'écoute du serveur */
+ gint raw_port; /* Port d'écoute du serveur */
+ char *port; /* Port d'écoute du serveur */
GtkToggleButton *use_remote; /* Choix du serveur distant */
gboolean active; /* Etat du choix du distant */
GtkTreeModel *model; /* Modèle de gestion utilisé */
@@ -287,10 +293,14 @@ void update_binary_storage(GtkBuilder *builder, GLoadedBinary *binary)
host = gtk_entry_get_text(GTK_ENTRY(widget));
widget = gtk_builder_get_object(builder, "port");
- port = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+ raw_port = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
+
+ asprintf(&port, "%d", raw_port);
g_loaded_binary_set_remote_server(binary, host, port);
+ free(port);
+
/* Choix final du serveur */
use_remote = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder, "use_remote"));
diff --git a/src/gui/dialogs/storage.ui b/src/gui/dialogs/storage.ui
index 0a65f47..0a9bb89 100644
--- a/src/gui/dialogs/storage.ui
+++ b/src/gui/dialogs/storage.ui
@@ -23,10 +23,6 @@
</object>
<object class="GtkDialog" id="window">
<property name="can_focus">False</property>
- <property name="margin_left">4</property>
- <property name="margin_right">4</property>
- <property name="margin_top">4</property>
- <property name="margin_bottom">4</property>
<property name="title" translatable="yes">Storage</property>
<property name="modal">True</property>
<property name="window_position">center-on-parent</property>
@@ -36,11 +32,16 @@
<child internal-child="vbox">
<object class="GtkBox">
<property name="can_focus">False</property>
+ <property name="margin_left">8</property>
+ <property name="margin_right">8</property>
+ <property name="margin_top">8</property>
+ <property name="margin_bottom">8</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox">
<property name="can_focus">False</property>
+ <property name="margin_top">8</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button1">
@@ -93,6 +94,7 @@
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="margin_top">8</property>
<property name="left_padding">12</property>
<child>
<object class="GtkBox">
@@ -101,20 +103,6 @@
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Note: DB items will use local storage as fallback if this server can not be contacted.</property>
- <property name="wrap">True</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -174,6 +162,20 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Note: database items will use internal storage as fallback if this server can not be contacted.</property>
+ <property name="wrap">True</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@@ -202,12 +204,14 @@
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="margin_top">8</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="margin_top">8</property>
<property name="left_padding">12</property>
<child>
<object class="GtkScrolledWindow">
@@ -272,7 +276,7 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">DB items</property>
+ <property name="label" translatable="yes">Database items</property>
</object>
</child>
</object>