diff options
Diffstat (limited to 'src/gui/dialogs')
| -rw-r--r-- | src/gui/dialogs/snapshots.c | 2 | ||||
| -rw-r--r-- | src/gui/dialogs/storage.c | 142 | ||||
| -rw-r--r-- | src/gui/dialogs/storage.ui | 193 | 
3 files changed, 53 insertions, 284 deletions
diff --git a/src/gui/dialogs/snapshots.c b/src/gui/dialogs/snapshots.c index 53fc7b0..91bd70e 100644 --- a/src/gui/dialogs/snapshots.c +++ b/src/gui/dialogs/snapshots.c @@ -226,7 +226,7 @@ static void on_server_selection_changed(GtkComboBox *combo, GtkBuilder *builder)      binary = G_LOADED_BINARY(g_object_get_data(G_OBJECT(builder), "binary")); -    client = g_loaded_binary_get_client(binary, active == 0); +    client = g_loaded_binary_get_client(binary);      if (client == NULL)      { diff --git a/src/gui/dialogs/storage.c b/src/gui/dialogs/storage.c index 4822231..b6fc920 100644 --- a/src/gui/dialogs/storage.c +++ b/src/gui/dialogs/storage.c @@ -33,27 +33,9 @@ -/* Colonnes de la liste des collections */ -typedef enum _CollecFeatureColumn -{ -    CFC_COLLECTION,                         /* Instance GLib               */ - -    CFC_NAME,                               /* Désignation humaine         */ -    CFC_LOCAL,                              /* Sauvegarde locale ?         */ -    CFC_REMOTE,                             /* Sauvegarde distante ?       */ - -} CollecFeatureColumn; - -  /* Réagit à un changement dans le choix du type de serveur. */  static void on_server_use_toggled(GtkToggleButton *, GtkBuilder *); -/* Bascule le lieu d'enregistrement d'un type de collection. */ -static void on_local_feature_toggled(GtkCellRendererToggle *, gchar *, GtkBuilder *); - -/* Bascule le lieu d'enregistrement d'un type de collection. */ -static void on_remote_feature_toggled(GtkCellRendererToggle *, gchar *, GtkBuilder *); -  /****************************************************************************** @@ -111,37 +93,10 @@ GtkWidget *create_storage_dialog(GLoadedBinary *binary, GtkWindow *parent, GtkBu      on_server_use_toggled(use_remote, builder); -    /* Intégration des différentes collections */ - -    store = GTK_LIST_STORE(gtk_builder_get_object(builder, "store")); - -    collections = g_loaded_binary_get_collections(binary, &count); - -    for (i = 0; i < count; i++) -    { -        feature = g_db_collection_get_feature(collections[i]); - -        gtk_list_store_append(store, &iter); -        gtk_list_store_set(store, &iter, -                           CFC_COLLECTION, collections[i], -                           CFC_NAME, g_db_collection_get_name(collections[i]), -                           CFC_LOCAL, g_loaded_binary_get_storage(binary, feature) == DBS_ALL_LOCAL, -                           CFC_REMOTE, g_loaded_binary_get_storage(binary, feature) != DBS_ALL_LOCAL, -                           -1); - -        g_object_unref(G_OBJECT(collections[i])); - -    } - -    if (collections != NULL) -        free(collections); -      /* Connexion des signaux */      gtk_builder_add_callback_symbols(builder,                                       BUILDER_CALLBACK(on_server_use_toggled), -                                     BUILDER_CALLBACK(on_local_feature_toggled), -                                     BUILDER_CALLBACK(on_remote_feature_toggled),                                       NULL);      gtk_builder_connect_signals(builder, builder); @@ -188,82 +143,6 @@ static void on_server_use_toggled(GtkToggleButton *button, GtkBuilder *builder)  /******************************************************************************  *                                                                             * -*  Paramètres  : renderer = rendu de cellule à l'origine de la procédure.     * -*                path     = chemin d'accès à la ligne éditée.                 * -*                builder  = espace de référencement global.                   * -*                                                                             * -*  Description : Bascule le lieu d'enregistrement d'un type de collection.    * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void on_local_feature_toggled(GtkCellRendererToggle *renderer, gchar *path, GtkBuilder *builder) -{ -    GtkTreePath *access;                    /* Véritable chemin d'accès    */ -    GtkTreeModel *model;                    /* Modèle de gestion utilisé   */ -    GtkTreeIter iter;                       /* Point d'actualisation       */ - -    access = gtk_tree_path_new_from_string(path); - -    model = GTK_TREE_MODEL(gtk_builder_get_object(builder, "store")); - -    if (gtk_tree_model_get_iter(model, &iter, access)) -    { -        gtk_list_store_set(GTK_LIST_STORE(model), &iter, -                           CFC_LOCAL, true, -                           CFC_REMOTE, false, -                           -1); - -    } - -    gtk_tree_path_free(access); - -} - - -/****************************************************************************** -*                                                                             * -*  Paramètres  : renderer = rendu de cellule à l'origine de la procédure.     * -*                path     = chemin d'accès à la ligne éditée.                 * -*                builder  = espace de référencement global.                   * -*                                                                             * -*  Description : Bascule le lieu d'enregistrement d'un type de collection.    * -*                                                                             * -*  Retour      : -                                                            * -*                                                                             * -*  Remarques   : -                                                            * -*                                                                             * -******************************************************************************/ - -static void on_remote_feature_toggled(GtkCellRendererToggle *renderer, gchar *path, GtkBuilder *builder) -{ -    GtkTreePath *access;                    /* Véritable chemin d'accès    */ -    GtkTreeModel *model;                    /* Modèle de gestion utilisé   */ -    GtkTreeIter iter;                       /* Point d'actualisation       */ - -    access = gtk_tree_path_new_from_string(path); - -    model = GTK_TREE_MODEL(gtk_builder_get_object(builder, "store")); - -    if (gtk_tree_model_get_iter(model, &iter, access)) -    { -        gtk_list_store_set(GTK_LIST_STORE(model), &iter, -                           CFC_LOCAL, false, -                           CFC_REMOTE, true, -                           -1); - -    } - -    gtk_tree_path_free(access); - -} - - -/****************************************************************************** -*                                                                             *  *  Paramètres  : builder = espace de référencement global.                    *  *                binary  = binaire chargé en mémoire à traiter.               *  *                                                                             * @@ -312,25 +191,4 @@ void update_binary_storage(GtkBuilder *builder, GLoadedBinary *binary)      g_loaded_binary_set_remote_storage_usage(binary, active); -    /* Type de conservation des éléments */ - -    model = GTK_TREE_MODEL(gtk_builder_get_object(builder, "store")); - -    for (valid = gtk_tree_model_get_iter_first(model, &iter); -         valid; -         valid = gtk_tree_model_iter_next(model, &iter)) -    { -        gtk_tree_model_get(model, &iter, -                           CFC_COLLECTION, &collec, -                           CFC_LOCAL, &local, -                           -1); - -        feature = g_db_collection_get_feature(collec); - -        g_loaded_binary_set_storage(binary, feature, local ? DBS_ALL_LOCAL : DBS_ALL_REMOTE); - -        g_object_unref(G_OBJECT(collec)); - -    } -  } diff --git a/src/gui/dialogs/storage.ui b/src/gui/dialogs/storage.ui index 0a9bb89..f079dab 100644 --- a/src/gui/dialogs/storage.ui +++ b/src/gui/dialogs/storage.ui @@ -1,55 +1,43 @@  <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.21.0 --> +<!-- Generated with glade 3.37.0 -->  <interface>    <requires lib="gtk+" version="3.20"/>    <object class="GtkAdjustment" id="port_adj">      <property name="lower">1</property>      <property name="upper">65535</property>      <property name="value">0.01</property> -    <property name="step_increment">1</property> -    <property name="page_increment">10</property> -  </object> -  <object class="GtkListStore" id="store"> -    <columns> -      <!-- column-name collec --> -      <column type="GObject"/> -      <!-- column-name name --> -      <column type="gchararray"/> -      <!-- column-name local --> -      <column type="gboolean"/> -      <!-- column-name remote --> -      <column type="gboolean"/> -    </columns> +    <property name="step-increment">1</property> +    <property name="page-increment">10</property>    </object>    <object class="GtkDialog" id="window"> -    <property name="can_focus">False</property> +    <property name="can-focus">False</property>      <property name="title" translatable="yes">Storage</property>      <property name="modal">True</property> -    <property name="window_position">center-on-parent</property> -    <property name="default_width">500</property> -    <property name="default_height">350</property> -    <property name="type_hint">dialog</property> +    <property name="window-position">center-on-parent</property> +    <property name="default-width">500</property> +    <property name="default-height">350</property> +    <property name="type-hint">dialog</property>      <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="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> +            <property name="can-focus">False</property> +            <property name="margin-top">8</property> +            <property name="layout-style">end</property>              <child>                <object class="GtkButton" id="button1">                  <property name="label">gtk-cancel</property>                  <property name="visible">True</property> -                <property name="can_focus">True</property> -                <property name="receives_default">True</property> -                <property name="use_stock">True</property> +                <property name="can-focus">True</property> +                <property name="receives-default">True</property> +                <property name="use-stock">True</property>                </object>                <packing>                  <property name="expand">True</property> @@ -61,9 +49,9 @@                <object class="GtkButton" id="button2">                  <property name="label">gtk-apply</property>                  <property name="visible">True</property> -                <property name="can_focus">True</property> -                <property name="receives_default">True</property> -                <property name="use_stock">True</property> +                <property name="can-focus">True</property> +                <property name="receives-default">True</property> +                <property name="use-stock">True</property>                </object>                <packing>                  <property name="expand">True</property> @@ -81,37 +69,37 @@          <child>            <object class="GtkBox">              <property name="visible">True</property> -            <property name="can_focus">False</property> +            <property name="can-focus">False</property>              <property name="orientation">vertical</property>              <property name="spacing">8</property>              <child>                <object class="GtkFrame">                  <property name="visible">True</property> -                <property name="can_focus">False</property> -                <property name="label_xalign">0</property> -                <property name="shadow_type">none</property> +                <property name="can-focus">False</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> +                    <property name="can-focus">False</property> +                    <property name="margin-top">8</property> +                    <property name="left-padding">12</property>                      <child>                        <object class="GtkBox">                          <property name="visible">True</property> -                        <property name="can_focus">False</property> +                        <property name="can-focus">False</property>                          <property name="orientation">vertical</property>                          <property name="spacing">8</property>                          <child>                            <object class="GtkBox">                              <property name="visible">True</property> -                            <property name="can_focus">False</property> +                            <property name="can-focus">False</property>                              <property name="hexpand">True</property>                              <property name="spacing">8</property>                              <child>                                <object class="GtkLabel" id="server_label">                                  <property name="visible">True</property> -                                <property name="can_focus">False</property> +                                <property name="can-focus">False</property>                                  <property name="label" translatable="yes">Server:</property>                                </object>                                <packing> @@ -123,7 +111,7 @@                              <child>                                <object class="GtkEntry" id="server">                                  <property name="visible">True</property> -                                <property name="can_focus">True</property> +                                <property name="can-focus">True</property>                                </object>                                <packing>                                  <property name="expand">True</property> @@ -134,7 +122,7 @@                              <child>                                <object class="GtkLabel" id="port_label">                                  <property name="visible">True</property> -                                <property name="can_focus">False</property> +                                <property name="can-focus">False</property>                                  <property name="label" translatable="yes">Port:</property>                                </object>                                <packing> @@ -146,8 +134,8 @@                              <child>                                <object class="GtkSpinButton" id="port">                                  <property name="visible">True</property> -                                <property name="can_focus">True</property> -                                <property name="max_width_chars">5</property> +                                <property name="can-focus">True</property> +                                <property name="max-width-chars">5</property>                                  <property name="text" translatable="yes">1</property>                                  <property name="adjustment">port_adj</property>                                  <property name="value">1</property> @@ -168,7 +156,7 @@                          <child>                            <object class="GtkLabel">                              <property name="visible">True</property> -                            <property name="can_focus">False</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> @@ -187,9 +175,9 @@                    <object class="GtkCheckButton" id="use_remote">                      <property name="label" translatable="yes">Use a remote shared server</property>                      <property name="visible">True</property> -                    <property name="can_focus">True</property> -                    <property name="receives_default">False</property> -                    <property name="draw_indicator">True</property> +                    <property name="can-focus">True</property> +                    <property name="receives-default">False</property> +                    <property name="draw-indicator">True</property>                      <signal name="toggled" handler="on_server_use_toggled" swapped="no"/>                    </object>                  </child> @@ -200,92 +188,6 @@                  <property name="position">0</property>                </packing>              </child> -            <child> -              <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"> -                        <property name="visible">True</property> -                        <property name="can_focus">True</property> -                        <property name="shadow_type">in</property> -                        <child> -                          <object class="GtkTreeView"> -                            <property name="visible">True</property> -                            <property name="can_focus">True</property> -                            <property name="model">store</property> -                            <child internal-child="selection"> -                              <object class="GtkTreeSelection"/> -                            </child> -                            <child> -                              <object class="GtkTreeViewColumn"> -                                <property name="title" translatable="yes">Name</property> -                                <property name="expand">True</property> -                                <child> -                                  <object class="GtkCellRendererText" id="name"/> -                                  <attributes> -                                    <attribute name="text">1</attribute> -                                  </attributes> -                                </child> -                              </object> -                            </child> -                            <child> -                              <object class="GtkTreeViewColumn"> -                                <property name="title" translatable="yes">Local</property> -                                <child> -                                  <object class="GtkCellRendererToggle" id="local"> -                                    <property name="radio">True</property> -                                    <signal name="toggled" handler="on_local_feature_toggled" swapped="no"/> -                                  </object> -                                  <attributes> -                                    <attribute name="active">2</attribute> -                                  </attributes> -                                </child> -                              </object> -                            </child> -                            <child> -                              <object class="GtkTreeViewColumn"> -                                <property name="title" translatable="yes">Remote</property> -                                <child> -                                  <object class="GtkCellRendererToggle" id="remote"> -                                    <property name="radio">True</property> -                                    <signal name="toggled" handler="on_remote_feature_toggled" swapped="no"/> -                                  </object> -                                  <attributes> -                                    <attribute name="active">3</attribute> -                                  </attributes> -                                </child> -                              </object> -                            </child> -                          </object> -                        </child> -                      </object> -                    </child> -                  </object> -                </child> -                <child type="label"> -                  <object class="GtkLabel"> -                    <property name="visible">True</property> -                    <property name="can_focus">False</property> -                    <property name="label" translatable="yes">Database items</property> -                  </object> -                </child> -              </object> -              <packing> -                <property name="expand">True</property> -                <property name="fill">True</property> -                <property name="position">1</property> -              </packing> -            </child>            </object>            <packing>              <property name="expand">True</property> @@ -299,8 +201,17 @@        <action-widget response="-6">button1</action-widget>        <action-widget response="-10">button2</action-widget>      </action-widgets> -    <child> -      <placeholder/> -    </child> +  </object> +  <object class="GtkListStore" id="store"> +    <columns> +      <!-- column-name collec --> +      <column type="GObject"/> +      <!-- column-name name --> +      <column type="gchararray"/> +      <!-- column-name local --> +      <column type="gboolean"/> +      <!-- column-name remote --> +      <column type="gboolean"/> +    </columns>    </object>  </interface>  | 
