[gnome-disk-utility/udisks2-port] Remove iSCSI bits for now



commit 2f06ecec50bb48a33e92bf514004c70c56393980
Author: David Zeuthen <davidz redhat com>
Date:   Wed Jun 15 11:52:26 2011 -0400

    Remove iSCSI bits for now
    
    This will be added back later.
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 data/ui/palimpsest.ui               |  246 +-------------------
 src/palimpsest/Makefile.am          |    1 -
 src/palimpsest/gdudevicetreemodel.c |  367 +----------------------------
 src/palimpsest/gduiscsipathmodel.c  |  332 -------------------------
 src/palimpsest/gduiscsipathmodel.h  |   55 -----
 src/palimpsest/gduwindow.c          |  454 -----------------------------------
 6 files changed, 5 insertions(+), 1450 deletions(-)
---
diff --git a/data/ui/palimpsest.ui b/data/ui/palimpsest.ui
index 0c1f758..fe29130 100644
--- a/data/ui/palimpsest.ui
+++ b/data/ui/palimpsest.ui
@@ -1266,254 +1266,12 @@
               </packing>
             </child>
             <child>
-              <object class="GtkVBox" id="iscsitab_vbox">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="spacing">12</property>
-                <child>
-                  <object class="GtkTable" id="iscsitab-table">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="n_rows">3</property>
-                    <property name="n_columns">2</property>
-                    <property name="column_spacing">12</property>
-                    <child>
-                      <object class="GtkLabel" id="iscsitab-alias-label">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">1</property>
-                        <property name="label" translatable="yes">Alias</property>
-                        <attributes>
-                          <attribute name="foreground" value="#555555555555"/>
-                        </attributes>
-                      </object>
-                      <packing>
-                        <property name="x_options">GTK_FILL</property>
-                        <property name="y_options"></property>
-                        <property name="y_padding">4</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="iscsitab-name-label">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">1</property>
-                        <property name="label" translatable="yes">Name</property>
-                        <attributes>
-                          <attribute name="foreground" value="#555555555555"/>
-                        </attributes>
-                      </object>
-                      <packing>
-                        <property name="top_attach">1</property>
-                        <property name="bottom_attach">2</property>
-                        <property name="x_options">GTK_FILL</property>
-                        <property name="y_options"></property>
-                        <property name="y_padding">4</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="iscsitab-alias-value-label">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="hexpand">True</property>
-                        <property name="xalign">0</property>
-                        <property name="selectable">True</property>
-                        <property name="ellipsize">end</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
-                        <property name="x_options">GTK_FILL</property>
-                        <property name="y_options"></property>
-                        <property name="y_padding">4</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="iscsitab-name-value-label">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="hexpand">True</property>
-                        <property name="xalign">0</property>
-                        <property name="selectable">True</property>
-                        <property name="ellipsize">end</property>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
-                        <property name="top_attach">1</property>
-                        <property name="bottom_attach">2</property>
-                        <property name="x_options">GTK_FILL</property>
-                        <property name="y_options"></property>
-                        <property name="y_padding">4</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkLabel" id="iscsitab-connection-label">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="xalign">1</property>
-                        <property name="label" translatable="yes">_Connection</property>
-                        <property name="use_underline">True</property>
-                        <attributes>
-                          <attribute name="foreground" value="#555555555555"/>
-                        </attributes>
-                      </object>
-                      <packing>
-                        <property name="top_attach">2</property>
-                        <property name="bottom_attach">3</property>
-                        <property name="x_options">GTK_FILL</property>
-                        <property name="y_options"></property>
-                        <property name="y_padding">4</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <object class="GtkHBox" id="iscsitab-connection-hbox">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <child>
-                          <placeholder/>
-                        </child>
-                        <child>
-                          <placeholder/>
-                        </child>
-                        <child>
-                          <placeholder/>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="left_attach">1</property>
-                        <property name="right_attach">2</property>
-                        <property name="top_attach">2</property>
-                        <property name="bottom_attach">3</property>
-                        <property name="x_options">GTK_FILL</property>
-                        <property name="y_options"></property>
-                        <property name="y_padding">4</property>
-                      </packing>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="iscsitab-main-label">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
-                    <property name="label" translatable="yes">&lt;b&gt;C_onnections&lt;/b&gt;</property>
-                    <property name="use_markup">True</property>
-                    <property name="use_underline">True</property>
-                    <property name="mnemonic_widget">iscsi-connections-treeview</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">True</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkAlignment" id="alignment2">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="left_padding">12</property>
-                    <child>
-                      <object class="GtkVBox" id="vbox2">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <child>
-                          <object class="GtkScrolledWindow" id="iscsitab-scrolledwindow">
-                            <property name="visible">True</property>
-                            <property name="can_focus">True</property>
-                            <property name="hscrollbar_policy">never</property>
-                            <property name="shadow_type">in</property>
-                            <child>
-                              <object class="GtkTreeView" id="iscsi-connections-treeview">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="show_expanders">False</property>
-                                <property name="level_indentation">12</property>
-                                <child internal-child="selection">
-                                  <object class="GtkTreeSelection" id="treeview-selection"/>
-                                </child>
-                              </object>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="expand">True</property>
-                            <property name="fill">True</property>
-                            <property name="position">0</property>
-                          </packing>
-                        </child>
-                        <child>
-                          <object class="GtkToolbar" id="iscsitab-toolbar">
-                            <property name="visible">True</property>
-                            <property name="can_focus">False</property>
-                            <property name="icon_size">1</property>
-                            <child>
-                              <object class="GtkToolButton" id="iscsitab-add-toolbutton">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="use_action_appearance">False</property>
-                                <property name="icon_name">list-add-symbolic</property>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="homogeneous">True</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkToolButton" id="iscsitab-remove-toolbutton">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="use_action_appearance">False</property>
-                                <property name="icon_name">list-remove-symbolic</property>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="homogeneous">True</property>
-                              </packing>
-                            </child>
-                          </object>
-                          <packing>
-                            <property name="expand">False</property>
-                            <property name="fill">False</property>
-                            <property name="position">1</property>
-                          </packing>
-                        </child>
-                      </object>
-                    </child>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">2</property>
-                  </packing>
-                </child>
-              </object>
-              <packing>
-                <property name="position">3</property>
-              </packing>
-            </child>
-            <child type="tab">
-              <object class="GtkLabel" id="iscsitab_label">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="label" translatable="yes">iscsi target</property>
-              </object>
-              <packing>
-                <property name="position">3</property>
-                <property name="tab_fill">False</property>
-              </packing>
-            </child>
-            <child>
               <object class="GtkVBox" id="newtab_vbox">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
               </object>
               <packing>
-                <property name="position">4</property>
+                <property name="position">3</property>
               </packing>
             </child>
             <child type="tab">
@@ -1523,7 +1281,7 @@
                 <property name="label" translatable="yes">new</property>
               </object>
               <packing>
-                <property name="position">4</property>
+                <property name="position">3</property>
                 <property name="tab_fill">False</property>
               </packing>
             </child>
diff --git a/src/palimpsest/Makefile.am b/src/palimpsest/Makefile.am
index 6cca8ca..9019a68 100644
--- a/src/palimpsest/Makefile.am
+++ b/src/palimpsest/Makefile.am
@@ -27,7 +27,6 @@ palimpsest_SOURCES = 					\
 	gdu.h						\
 	gduapplication.h	gduapplication.c	\
 	gdudevicetreemodel.h	gdudevicetreemodel.c	\
-	gduiscsipathmodel.h	gduiscsipathmodel.c	\
 	gdutypes.h					\
 	gduutils.h		gduutils.c		\
 	gduvolumegrid.h		gduvolumegrid.c		\
diff --git a/src/palimpsest/gdudevicetreemodel.c b/src/palimpsest/gdudevicetreemodel.c
index 5a2facc..2149857 100644
--- a/src/palimpsest/gdudevicetreemodel.c
+++ b/src/palimpsest/gdudevicetreemodel.c
@@ -39,11 +39,6 @@ struct _GduDeviceTreeModel
   GList *current_blocks;
   GtkTreeIter block_iter;
   gboolean block_iter_valid;
-
-  /* These are UDisksObjects for collections, targets and LUNs */
-  GList *current_iscsi_objects;
-  GtkTreeIter iscsi_iter;
-  gboolean iscsi_iter_valid;
 };
 
 typedef struct
@@ -232,6 +227,7 @@ find_iter_for_object (GduDeviceTreeModel *model,
   return data.found;
 }
 
+#if 0
 static gboolean
 find_iter_for_object_path (GduDeviceTreeModel *model,
                            const gchar        *object_path,
@@ -253,6 +249,7 @@ find_iter_for_object_path (GduDeviceTreeModel *model,
 
   return data.found;
 }
+#endif
 
 /* ---------------------------------------------------------------------------------------------------- */
 
@@ -529,27 +526,6 @@ remove_lun (GduDeviceTreeModel *model,
   ;
 }
 
-static gboolean
-should_include_lun (UDisksObject *object,
-                    gboolean      allow_iscsi)
-{
-  UDisksLun *lun;
-  gboolean ret;
-
-  ret = FALSE;
-
-  lun = udisks_object_peek_lun (object);
-
-  /* unless specificlly allowed, don't show LUNs paired with an iSCSI target */
-  if (!allow_iscsi && g_strcmp0 (udisks_lun_get_iscsi_target (lun), "/") != 0)
-    goto out;
-
-  ret = TRUE;
-
- out:
-  return ret;
-}
-
 static void
 update_luns (GduDeviceTreeModel *model)
 {
@@ -573,8 +549,7 @@ update_luns (GduDeviceTreeModel *model)
       if (lun == NULL)
         continue;
 
-      if (should_include_lun (object, FALSE))
-        luns = g_list_prepend (luns, g_object_ref (object));
+      luns = g_list_prepend (luns, g_object_ref (object));
     }
 
   luns = g_list_sort (luns, (GCompareFunc) _g_dbus_object_compare);
@@ -852,348 +827,12 @@ update_blocks (GduDeviceTreeModel *model)
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static GtkTreeIter *
-get_iscsi_iter (GduDeviceTreeModel *model)
-{
-  gchar *s;
-
-  if (model->iscsi_iter_valid)
-    goto out;
-
-  s = g_strdup_printf ("<small><span foreground=\"#555555\">%s</span></small>",
-                       _("iSCSI"));
-  gtk_tree_store_insert_with_values (GTK_TREE_STORE (model),
-                                     &model->iscsi_iter,
-                                     NULL, /* GtkTreeIter *parent */
-                                     0,
-                                     GDU_DEVICE_TREE_MODEL_COLUMN_IS_HEADING, TRUE,
-                                     GDU_DEVICE_TREE_MODEL_COLUMN_HEADING_TEXT, s,
-                                     GDU_DEVICE_TREE_MODEL_COLUMN_SORT_KEY, "02_iscsi",
-                                     -1);
-  g_free (s);
-
-  model->iscsi_iter_valid = TRUE;
-
- out:
-  return &model->iscsi_iter;
-}
-
-static void
-nuke_iscsi_iter (GduDeviceTreeModel *model)
-{
-  if (model->iscsi_iter_valid)
-    {
-      gtk_tree_store_remove (GTK_TREE_STORE (model), &model->iscsi_iter);
-      model->iscsi_iter_valid = FALSE;
-    }
-}
-
-static void
-add_iscsi_collection (GduDeviceTreeModel  *model,
-                      UDisksObject        *object,
-                      GtkTreeIter         *parent)
-{
-  UDisksIScsiCollection *collection;
-  const gchar *mechanism;
-  GIcon *icon;
-  gchar *s;
-  gchar *sort_key;
-  GtkTreeIter iter;
-
-  collection = udisks_object_peek_iscsi_collection (object);
-  mechanism = udisks_iscsi_collection_get_mechanism (collection);
-
-  icon = g_themed_icon_new_with_default_fallbacks ("network_local");
-  if (g_strcmp0 (mechanism, "sendtargets") == 0)
-    {
-      s = g_strdup_printf ("%s\n"
-                           "<small><span foreground=\"#555555\">%s</span></small>",
-                           _("SendTargets Discovery"),
-                           udisks_iscsi_collection_get_discovery_address (collection));
-    }
-  else if (g_strcmp0 (mechanism, "isns") == 0)
-    {
-      s = g_strdup_printf ("%s\n"
-                           "<small><span foreground=\"#555555\">%s</span></small>",
-                           _("iSNS Discovery"),
-                           udisks_iscsi_collection_get_discovery_address (collection));
-    }
-  else if (g_strcmp0 (mechanism, "static") == 0)
-    {
-      s = g_strdup (_("Statically Configured"));
-    }
-  else if (g_strcmp0 (mechanism, "firmware") == 0)
-    {
-      s = g_strdup (_("Configured by Firmware"));
-    }
-  else
-    {
-      /* This is a fallback */
-      s = g_strdup_printf ("%s\n"
-                           "<small><span foreground=\"#555555\">%s</span></small>",
-                           mechanism,
-                           udisks_iscsi_collection_get_discovery_address (collection));
-    }
-
-  sort_key = g_strdup (g_dbus_object_get_object_path (G_DBUS_OBJECT (object))); /* for now */
-  gtk_tree_store_insert_with_values (GTK_TREE_STORE (model),
-                                     &iter,
-                                     parent,
-                                     0,
-                                     GDU_DEVICE_TREE_MODEL_COLUMN_ICON, icon,
-                                     GDU_DEVICE_TREE_MODEL_COLUMN_NAME, s,
-                                     GDU_DEVICE_TREE_MODEL_COLUMN_SORT_KEY, sort_key,
-                                     GDU_DEVICE_TREE_MODEL_COLUMN_OBJECT, object,
-                                     -1);
-  g_object_unref (icon);
-  g_free (sort_key);
-  g_free (s);
-}
-
-static void
-add_iscsi_target (GduDeviceTreeModel  *model,
-                  UDisksObject        *object,
-                  GtkTreeIter         *parent)
-{
-  UDisksIScsiTarget *target;
-  GIcon *icon;
-  gchar *s;
-  gchar *sort_key;
-  GtkTreeIter iter;
-
-  target = udisks_object_peek_iscsi_target (object);
-
-#if 0
-  GIcon *base_icon;
-  GIcon *emblem_icon;
-  GEmblem *emblem;
-  emblem_icon = g_themed_icon_new_with_default_fallbacks ("emblem-web");
-  emblem = g_emblem_new (emblem_icon);
-  base_icon = g_themed_icon_new_with_default_fallbacks ("drive-harddisk");
-  icon = g_emblemed_icon_new (base_icon, emblem);
-  g_object_unref (emblem);
-  g_object_unref (base_icon);
-  g_object_unref (emblem_icon);
-#endif
-  icon = g_themed_icon_new_with_default_fallbacks ("network-server");
-
-  s = g_strdup_printf ("%s\n"
-                       "<small><span foreground=\"#555555\">%s</span></small>",
-                       "Remote iSCSI Target", /* TODO: alias */
-                       udisks_iscsi_target_get_name (target));
-
-  sort_key = g_strdup (g_dbus_object_get_object_path (G_DBUS_OBJECT (object))); /* for now */
-  gtk_tree_store_insert_with_values (GTK_TREE_STORE (model),
-                                     &iter,
-                                     parent,
-                                     0,
-                                     GDU_DEVICE_TREE_MODEL_COLUMN_ICON, icon,
-                                     GDU_DEVICE_TREE_MODEL_COLUMN_NAME, s,
-                                     GDU_DEVICE_TREE_MODEL_COLUMN_SORT_KEY, sort_key,
-                                     GDU_DEVICE_TREE_MODEL_COLUMN_OBJECT, object,
-                                     -1);
-  g_object_unref (icon);
-  g_free (sort_key);
-  g_free (s);
-}
-
-static void
-remove_iscsi_target (GduDeviceTreeModel  *model,
-                     UDisksObject        *object)
-{
-  GtkTreeIter iter;
-
-  if (!find_iter_for_object (model,
-                             object,
-                             &iter))
-    {
-      g_warning ("Error finding iter for object at %s",
-                 g_dbus_object_get_object_path (G_DBUS_OBJECT (object)));
-      goto out;
-    }
-
-  gtk_tree_store_remove (GTK_TREE_STORE (model), &iter);
-
- out:
-  ;
-}
-
-static gint
-count_targets_for_collection (GDBusObjectManager    *object_manager,
-                              UDisksIScsiCollection *collection)
-{
-  gint ret;
-  GList *l;
-  GList *objects;
-  GDBusObject *collection_object;
-  const gchar *collection_object_path;
-
-  collection_object = g_dbus_interface_get_object (G_DBUS_INTERFACE (collection));
-  collection_object_path = g_dbus_object_get_object_path (collection_object);
-
-  ret = 0;
-  objects = g_dbus_object_manager_get_objects (object_manager);
-  for (l = objects; l != NULL; l = l->next)
-    {
-      UDisksObject *object = UDISKS_OBJECT (l->data);
-      UDisksIScsiTarget *target;
-      target = udisks_object_peek_iscsi_target (object);
-      if (target == NULL)
-        continue;
-      if (g_strcmp0 (udisks_iscsi_target_get_collection (target), collection_object_path) == 0)
-        ret++;
-    }
-  g_list_foreach (objects, (GFunc) g_object_unref, NULL);
-  g_list_free (objects);
-
-  return ret;
-}
-
-static void
-update_iscsi_targets (GduDeviceTreeModel *model)
-{
-  GDBusObjectManager *object_manager;
-  GList *objects;
-  GList *iscsi_objects;
-  GList *added;
-  GList *removed;
-  GList *l;
-
-  object_manager = udisks_client_get_object_manager (model->client);
-  objects = g_dbus_object_manager_get_objects (object_manager);
-
-  iscsi_objects = NULL;
-  for (l = objects; l != NULL; l = l->next)
-    {
-      UDisksObject *object = UDISKS_OBJECT (l->data);
-      UDisksIScsiTarget *target;
-      UDisksIScsiCollection *collection;
-
-      collection = udisks_object_peek_iscsi_collection (object);
-      if (collection != NULL)
-        {
-          /* Don't include an object for static or firmware unless they are non-empty */
-          if (g_strcmp0 (udisks_iscsi_collection_get_mechanism (collection), "static") == 0 ||
-              g_strcmp0 (udisks_iscsi_collection_get_mechanism (collection), "firmware") == 0)
-            {
-              if (count_targets_for_collection (object_manager, collection) == 0)
-                continue;
-            }
-          iscsi_objects = g_list_prepend (iscsi_objects, g_object_ref (object));
-        }
-
-      target = udisks_object_peek_iscsi_target (object);
-      if (target != NULL)
-        {
-          GList *ll;
-          const gchar *target_object_path;
-
-          iscsi_objects = g_list_prepend (iscsi_objects, g_object_ref (object));
-
-          /* also include the LUNs that are associated with this target */
-          target_object_path = g_dbus_object_get_object_path (G_DBUS_OBJECT (object));
-          for (ll = objects; ll != NULL; ll = ll->next)
-            {
-              UDisksObject *lun_object = UDISKS_OBJECT (ll->data);
-              UDisksLun *lun;
-              lun = udisks_object_peek_lun (lun_object);
-              if (lun != NULL)
-                {
-                  if (g_strcmp0 (udisks_lun_get_iscsi_target (lun), target_object_path) == 0)
-                    {
-                      if (should_include_lun (lun_object, TRUE))
-                        iscsi_objects = g_list_prepend (iscsi_objects, g_object_ref (lun_object));
-                    }
-                }
-            }
-        }
-    }
-
-  iscsi_objects = g_list_sort (iscsi_objects, (GCompareFunc) _g_dbus_object_compare);
-  model->current_iscsi_objects = g_list_sort (model->current_iscsi_objects, (GCompareFunc) _g_dbus_object_compare);
-  diff_sorted_lists (model->current_iscsi_objects,
-                     iscsi_objects,
-                     (GCompareFunc) _g_dbus_object_compare,
-                     &added,
-                     &removed);
-
-  for (l = removed; l != NULL; l = l->next)
-    {
-      UDisksObject *object = UDISKS_OBJECT (l->data);
-
-      g_assert (g_list_find (model->current_iscsi_objects, object) != NULL);
-
-      model->current_iscsi_objects = g_list_remove (model->current_iscsi_objects, object);
-      remove_iscsi_target (model, object);
-      g_object_unref (object);
-    }
-
-  /* Three passes: first add the iSCSI collections ... */
-  for (l = added; l != NULL; l = l->next)
-    {
-      UDisksObject *object = UDISKS_OBJECT (l->data);
-      if (udisks_object_peek_iscsi_collection (object) != NULL)
-        {
-          model->current_iscsi_objects = g_list_prepend (model->current_iscsi_objects,
-                                                         g_object_ref (object));
-          add_iscsi_collection (model, object, get_iscsi_iter (model));
-        }
-    }
-  /*  ... then the targets ... */
-  for (l = added; l != NULL; l = l->next)
-    {
-      UDisksObject *object = UDISKS_OBJECT (l->data);
-      if (udisks_object_peek_iscsi_target (object) != NULL)
-        {
-          GtkTreeIter iter;
-          GtkTreeIter *piter;
-          model->current_iscsi_objects = g_list_prepend (model->current_iscsi_objects,
-                                                         g_object_ref (object));
-          piter = &iter;
-          if (!find_iter_for_object_path (model,
-                                          udisks_iscsi_target_get_collection (udisks_object_peek_iscsi_target (object)),
-                                          &iter))
-            piter = get_iscsi_iter (model);
-          add_iscsi_target (model, object, piter);
-        }
-    }
-  /* ... and finally the LUNs */
-  for (l = added; l != NULL; l = l->next)
-    {
-      UDisksObject *object = UDISKS_OBJECT (l->data);
-      if (udisks_object_peek_lun (object) != NULL)
-        {
-          GtkTreeIter iter;
-          model->current_iscsi_objects = g_list_prepend (model->current_iscsi_objects,
-                                                         g_object_ref (object));
-          g_warn_if_fail (find_iter_for_object_path (model,
-                                                     udisks_lun_get_iscsi_target (udisks_object_peek_lun (object)),
-                                                     &iter));
-          add_lun (model, object, &iter);
-        }
-    }
-
-  if (g_list_length (model->current_iscsi_objects) == 0)
-    nuke_iscsi_iter (model);
-
-  g_list_free (added);
-  g_list_free (removed);
-  g_list_foreach (iscsi_objects, (GFunc) g_object_unref, NULL);
-  g_list_free (iscsi_objects);
-
-  g_list_foreach (objects, (GFunc) g_object_unref, NULL);
-  g_list_free (objects);
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
 static void
 update_all (GduDeviceTreeModel *model)
 {
   /* TODO: if this is CPU intensive we could coalesce all updates / schedule timeouts */
   update_luns (model);
   update_blocks (model);
-  update_iscsi_targets (model);
 }
 
 static void
diff --git a/src/palimpsest/gduwindow.c b/src/palimpsest/gduwindow.c
index a2a747e..ba05766 100644
--- a/src/palimpsest/gduwindow.c
+++ b/src/palimpsest/gduwindow.c
@@ -31,7 +31,6 @@
 #include "gdudevicetreemodel.h"
 #include "gduutils.h"
 #include "gduvolumegrid.h"
-#include "gduiscsipathmodel.h"
 
 /* Keep in sync with tabs in palimpsest.ui file */
 typedef enum
@@ -39,8 +38,6 @@ typedef enum
   DETAILS_PAGE_NOT_SELECTED,
   DETAILS_PAGE_NOT_IMPLEMENTED,
   DETAILS_PAGE_DEVICE,
-  DETAILS_PAGE_ISCSI_TARGET,
-  DETAILS_PAGE_ISCSI_SENDTARGETS_COLLECTION,
 } DetailsPage;
 
 struct _GduWindow
@@ -58,7 +55,6 @@ struct _GduWindow
 
   GtkWidget *volume_grid;
   GtkWidget *write_cache_switch;
-  GtkWidget *iscsi_connection_switch;
 
   GHashTable *label_connections;
 };
@@ -87,14 +83,6 @@ static void setup_device_page (GduWindow *window, UDisksObject *object);
 static void update_device_page (GduWindow *window);
 static void teardown_device_page (GduWindow *window);
 
-static void setup_iscsi_target_page (GduWindow *window, UDisksObject *object);
-static void update_iscsi_target_page (GduWindow *window);
-static void teardown_iscsi_target_page (GduWindow *window);
-
-//static void setup_iscsi_sendtargets_collection_page (GduWindow *window, UDisksObject *object);
-//static void update_iscsi_sendtargets_collection_page (GduWindow *window);
-//static void teardown_iscsi_sendtargets_collection_page (GduWindow *window);
-
 static void on_volume_grid_changed (GduVolumeGrid  *grid,
                                     gpointer        user_data);
 
@@ -108,10 +96,6 @@ static void on_devtab_action_lock_activated (GtkAction *action, gpointer user_da
 static void on_devtab_action_activate_swap_activated (GtkAction *action, gpointer user_data);
 static void on_devtab_action_deactivate_swap_activated (GtkAction *action, gpointer user_data);
 
-static void iscsi_connection_switch_on_notify_active (GObject     *object,
-                                                      GParamSpec  *pspec,
-                                                      gpointer     user_data);
-
 G_DEFINE_TYPE (GduWindow, gdu_window, GTK_TYPE_WINDOW);
 
 static void
@@ -222,8 +206,6 @@ static void
 set_selected_object (GduWindow    *window,
                      UDisksObject *object)
 {
-  UDisksIScsiCollection *collection;
-
   if (object != NULL)
     {
       if (udisks_object_peek_lun (object) != NULL ||
@@ -231,15 +213,6 @@ set_selected_object (GduWindow    *window,
         {
           select_details_page (window, object, DETAILS_PAGE_DEVICE);
         }
-      else if (udisks_object_peek_iscsi_target (object) != NULL)
-        {
-          select_details_page (window, object, DETAILS_PAGE_ISCSI_TARGET);
-        }
-      else if ((collection = udisks_object_peek_iscsi_collection (object)) != NULL &&
-               g_strcmp0 (udisks_iscsi_collection_get_mechanism (collection), "sendtargets") == 0)
-        {
-          select_details_page (window, object, DETAILS_PAGE_ISCSI_SENDTARGETS_COLLECTION);
-        }
       else
         {
           g_warning ("no page for object %s", g_dbus_object_get_object_path (G_DBUS_OBJECT (object)));
@@ -381,12 +354,6 @@ gdu_window_constructed (GObject *object)
   gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
   gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
 
-  context = gtk_widget_get_style_context (gdu_window_get_widget (window, "iscsitab-scrolledwindow"));
-  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
-  context = gtk_widget_get_style_context (gdu_window_get_widget (window, "iscsitab-toolbar"));
-  gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
-  gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
-
   window->model = gdu_device_tree_model_new (window->client);
 
   tree_view = GTK_TREE_VIEW (gdu_window_get_widget (window, "device-tree-treeview"));
@@ -494,18 +461,6 @@ gdu_window_constructed (GObject *object)
   gtk_label_set_mnemonic_widget (GTK_LABEL (gdu_window_get_widget (window, "devtab-write-cache-label")),
                                  window->write_cache_switch);
 
-  /* iSCSI tab's Connection switch */
-  window->iscsi_connection_switch = gtk_switch_new ();
-  g_signal_connect (window->iscsi_connection_switch,
-                    "notify::active",
-                    G_CALLBACK (iscsi_connection_switch_on_notify_active),
-                    window);
-  gtk_box_pack_start (GTK_BOX (gdu_window_get_widget (window, "iscsitab-connection-hbox")),
-                      window->iscsi_connection_switch,
-                      FALSE, TRUE, 0);
-  gtk_label_set_mnemonic_widget (GTK_LABEL (gdu_window_get_widget (window, "iscsitab-connection-label")),
-                                 window->iscsi_connection_switch);
-
   /* actions */
   g_signal_connect (gtk_builder_get_object (window->builder, "devtab-action-generic"),
                     "activate",
@@ -689,14 +644,6 @@ teardown_details_page (GduWindow    *window,
     case DETAILS_PAGE_DEVICE:
       teardown_device_page (window);
       break;
-
-    case DETAILS_PAGE_ISCSI_TARGET:
-      teardown_iscsi_target_page (window);
-      break;
-
-    case DETAILS_PAGE_ISCSI_SENDTARGETS_COLLECTION:
-      //TODO: teardown_iscsi_sendtargets_collection_page (window);
-      break;
     }
 }
 
@@ -834,14 +781,6 @@ setup_details_page (GduWindow     *window,
     case DETAILS_PAGE_DEVICE:
       setup_device_page (window, object);
       break;
-
-    case DETAILS_PAGE_ISCSI_TARGET:
-      setup_iscsi_target_page (window, object);
-      break;
-
-    case DETAILS_PAGE_ISCSI_SENDTARGETS_COLLECTION:
-      //TODO: setup_iscsi_sendtargets_collection_page (window, object);
-      break;
     }
 }
 
@@ -864,14 +803,6 @@ update_details_page (GduWindow   *window,
     case DETAILS_PAGE_DEVICE:
       update_device_page (window);
       break;
-
-    case DETAILS_PAGE_ISCSI_TARGET:
-      update_iscsi_target_page (window);
-      break;
-
-    case DETAILS_PAGE_ISCSI_SENDTARGETS_COLLECTION:
-      //TODO: update_iscsi_sendtargets_collection_page (window);
-      break;
     }
 }
 
@@ -923,22 +854,6 @@ update_all (GduWindow     *window,
           update_details_page (window, window->current_page);
         }
       break;
-
-    case DETAILS_PAGE_ISCSI_TARGET:
-      if (object == window->current_object)
-        {
-          update_details_page (window, window->current_page);
-        }
-      /* Nothing to update */
-      break;
-
-    case DETAILS_PAGE_ISCSI_SENDTARGETS_COLLECTION:
-      if (object == window->current_object)
-        {
-          update_details_page (window, window->current_page);
-        }
-      /* Nothing to update */
-      break;
     }
 }
 
@@ -1516,375 +1431,6 @@ teardown_device_page (GduWindow *window)
 /* ---------------------------------------------------------------------------------------------------- */
 
 static void
-iscsi_target_format_portal_address (GtkCellLayout   *cell_layout,
-                                    GtkCellRenderer *renderer,
-                                    GtkTreeModel    *tree_model,
-                                    GtkTreeIter     *iter,
-                                    gpointer         user_data)
-{
-  /* GduWindow *window = GDU_WINDOW (user_data); */
-  gchar *portal_address;
-  gint portal_port;
-  gchar *markup;
-
-  gtk_tree_model_get (tree_model,
-                      iter,
-                      GDU_ISCSI_PATH_MODEL_COLUMN_PORTAL_ADDRESS, &portal_address,
-                      GDU_ISCSI_PATH_MODEL_COLUMN_PORTAL_PORT, &portal_port,
-                      -1);
-
-  /* only show port if it is non-standard */
-  if (portal_port != 3260)
-    markup = g_strdup_printf ("%s:%d", portal_address, portal_port);
-  else
-    markup = g_strdup (portal_address);
-
-  g_object_set (renderer,
-                "markup", markup,
-                NULL);
-
-  g_free (markup);
-  g_free (portal_address);
-}
-
-static void
-iscsi_target_login_cb (UDisksIScsiTarget *target,
-                       GAsyncResult      *res,
-                       gpointer           user_data)
-{
-  GduWindow *window = GDU_WINDOW (user_data);
-  GError *error;
-  error = NULL;
-  if (!udisks_iscsi_target_call_login_finish (target, res, &error))
-    {
-      gdu_window_show_error (window,
-                             _("Error logging in to iSCSI target"),
-                             error);
-      g_error_free (error);
-    }
-  g_object_unref (window);
-}
-
-static void
-iscsi_target_logout_cb (UDisksIScsiTarget *target,
-                        GAsyncResult      *res,
-                        gpointer           user_data)
-{
-  GduWindow *window = GDU_WINDOW (user_data);
-  GError *error;
-  error = NULL;
-  if (!udisks_iscsi_target_call_logout_finish (target, res, &error))
-    {
-      gdu_window_show_error (window,
-                             _("Error logging out of iSCSI target"),
-                             error);
-      g_error_free (error);
-    }
-  g_object_unref (window);
-}
-
-static void
-on_iscsi_active_toggled (GtkCellRendererToggle *renderer,
-                         gchar                 *path,
-                         gpointer               user_data)
-{
-  GduWindow *window = GDU_WINDOW (user_data);
-  gboolean is_active;
-  GtkTreeView *tree_view;
-  GtkTreeModel *tree_model;
-  GtkTreeIter iter;
-  gchar *portal_address;
-  gchar *iface_name;
-  gint portal_port;
-  UDisksIScsiTarget *target;
-
-  portal_address = NULL;
-  iface_name = NULL;
-
-  tree_view = GTK_TREE_VIEW (gdu_window_get_widget (window, "iscsi-connections-treeview"));
-  tree_model = gtk_tree_view_get_model (tree_view);
-
-  target = udisks_object_peek_iscsi_target (window->current_object);
-  if (target == NULL)
-    {
-      g_warning ("Expected selected object to be an iSCSI target");
-      goto out;
-    }
-
-  if (!gtk_tree_model_get_iter_from_string (tree_model,
-                                            &iter,
-                                            path))
-    {
-      g_warning ("Unable to get tree iter");
-      goto out;
-    }
-
-  gtk_tree_model_get (tree_model,
-                      &iter,
-                      GDU_ISCSI_PATH_MODEL_COLUMN_PORTAL_ADDRESS, &portal_address,
-                      GDU_ISCSI_PATH_MODEL_COLUMN_PORTAL_PORT, &portal_port,
-                      GDU_ISCSI_PATH_MODEL_COLUMN_INTERFACE, &iface_name,
-                      -1);
-
-  is_active = gtk_cell_renderer_toggle_get_active (renderer);
-  if (is_active)
-    {
-          const gchar *options[] = {NULL};
-          udisks_iscsi_target_call_logout (target,
-                                           options,
-                                           portal_address,
-                                           portal_port,
-                                           iface_name,
-                                           NULL,  /* GCancellable* */
-                                           (GAsyncReadyCallback) iscsi_target_login_cb,
-                                           g_object_ref (window));
-    }
-  else
-    {
-          const gchar *options[] = {NULL};
-          udisks_iscsi_target_call_login (target,
-                                          options,
-                                          portal_address,
-                                          portal_port,
-                                          iface_name,
-                                          NULL,  /* GCancellable* */
-                                          (GAsyncReadyCallback) iscsi_target_login_cb,
-                                          g_object_ref (window));
-    }
-
- out:
-  g_free (portal_address);
-  g_free (iface_name);
-}
-
-static void
-init_iscsi_target_page (GduWindow   *window)
-{
-  static volatile gsize init_val = 0;
-  GtkTreeView *tree_view;
-  /* GtkTreeSelection *selection; */
-  GtkTreeViewColumn *column;
-  GtkCellRenderer *renderer;
-
-  if (!g_once_init_enter (&init_val))
-    goto out;
-
-  tree_view = GTK_TREE_VIEW (gdu_window_get_widget (window, "iscsi-connections-treeview"));
-  gtk_tree_view_set_rules_hint (tree_view, TRUE);
-#if 0
-  selection = gtk_tree_view_get_selection (tree_view);
-  gtk_tree_selection_set_select_function (selection, dont_select_headings, NULL, NULL);
-  g_signal_connect (selection,
-                    "changed",
-                    G_CALLBACK (on_tree_selection_changed),
-                    window);
-#endif
-
-  column = gtk_tree_view_column_new ();
-  gtk_tree_view_append_column (tree_view, column);
-  renderer = gtk_cell_renderer_toggle_new ();
-  gtk_tree_view_column_pack_end (column, renderer, FALSE);
-  gtk_tree_view_column_set_attributes (column, renderer,
-                                       "active", GDU_ISCSI_PATH_MODEL_COLUMN_ACTIVE, NULL);
-  g_signal_connect (renderer,
-                    "toggled",
-                    G_CALLBACK (on_iscsi_active_toggled),
-                    window);
-
-  column = gtk_tree_view_column_new ();
-  gtk_tree_view_column_set_title (column, _("Portal"));
-  gtk_tree_view_append_column (tree_view, column);
-  renderer = gtk_cell_renderer_text_new ();
-  gtk_tree_view_column_pack_start (column, renderer, TRUE);
-  gtk_tree_view_column_set_alignment (column, 0.0);
-  gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (column),
-                                      renderer,
-                                      iscsi_target_format_portal_address,
-                                      window,
-                                      NULL);
-
-  column = gtk_tree_view_column_new ();
-  gtk_tree_view_column_set_title (column, _("Network Interface"));
-  gtk_tree_view_append_column (tree_view, column);
-  renderer = gtk_cell_renderer_text_new ();
-  gtk_tree_view_column_pack_start (column, renderer, FALSE);
-  gtk_tree_view_column_set_attributes (column, renderer,
-                                       "markup", GDU_ISCSI_PATH_MODEL_COLUMN_INTERFACE, NULL);
-
-  column = gtk_tree_view_column_new ();
-  gtk_tree_view_column_set_title (column, _("TPGT"));
-  gtk_tree_view_append_column (tree_view, column);
-  renderer = gtk_cell_renderer_text_new ();
-  gtk_tree_view_column_pack_start (column, renderer, FALSE);
-  gtk_tree_view_column_set_attributes (column, renderer,
-                                       "markup", GDU_ISCSI_PATH_MODEL_COLUMN_TPGT, NULL);
-
-  column = gtk_tree_view_column_new ();
-  gtk_tree_view_column_set_title (column, _("Status"));
-  gtk_tree_view_append_column (tree_view, column);
-  renderer = gtk_cell_renderer_text_new ();
-  gtk_tree_view_column_pack_start (column, renderer, FALSE);
-  gtk_tree_view_column_set_attributes (column, renderer,
-                                       "markup", GDU_ISCSI_PATH_MODEL_COLUMN_STATUS, NULL);
-
-  g_once_init_leave (&init_val, 1);
- out:
-  ;
-}
-
-static gboolean
-iscsi_target_has_active_connections (UDisksIScsiTarget *target)
-{
-  GVariant *portals_and_interfaces;
-  GVariantIter portal_iter;
-  GVariantIter *iface_iter;
-  gboolean ret;
-
-  ret = FALSE;
-  portals_and_interfaces = udisks_iscsi_target_get_portals_and_interfaces (target);
-  g_variant_iter_init (&portal_iter, portals_and_interfaces);
-  while (g_variant_iter_next (&portal_iter,
-                              "(^&ayiia(ays))",
-                              NULL, /* &portal_adress */
-                              NULL, /* &port */
-                              NULL, /* &tpgt */
-                              &iface_iter))
-    {
-      const gchar *state;
-      while (g_variant_iter_next (iface_iter,
-                                  "(^&ays)",
-                                  NULL, /* &iface_name */
-                                  &state))
-        {
-          if (g_strcmp0 (state, "LOGGED_IN") == 0)
-            {
-              ret = TRUE;
-              goto out;
-            }
-        }
-    }
- out:
-  return ret;
-}
-
-
-static void
-update_iscsi_target_page (GduWindow   *window)
-{
-  GList *children;
-  GList *l;
-  UDisksIScsiTarget *target;
-
-  /* first hide everything */
-  children = gtk_container_get_children (GTK_CONTAINER (gdu_window_get_widget (window, "iscsitab-table")));
-  for (l = children; l != NULL; l = l->next)
-    {
-      GtkWidget *child = GTK_WIDGET (l->data);
-      gtk_widget_hide (child);
-    }
-  g_list_free (children);
-
-  target = udisks_object_peek_iscsi_target (window->current_object);
-  /* TODO: get Alias from somewhere */
-  set_markup (window,
-              "iscsitab-alias-label",
-              "iscsitab-alias-value-label",
-              "", SET_MARKUP_FLAGS_HYPHEN_IF_EMPTY);
-  set_markup (window,
-              "iscsitab-name-label",
-              "iscsitab-name-value-label",
-              udisks_iscsi_target_get_name (target), SET_MARKUP_FLAGS_NONE);
-
-  gtk_switch_set_active (GTK_SWITCH (window->iscsi_connection_switch),
-                         iscsi_target_has_active_connections (target));
-  gtk_widget_show (gdu_window_get_widget (window, "iscsitab-connection-label"));
-  gtk_widget_show_all (gdu_window_get_widget (window, "iscsitab-connection-hbox"));
-
-}
-
-static void
-iscsi_connection_switch_on_notify_active (GObject     *object,
-                                          GParamSpec  *pspec,
-                                          gpointer     user_data)
-{
-  GduWindow *window = GDU_WINDOW (user_data);
-  gboolean active;
-  gboolean has_connections;
-  UDisksIScsiTarget *target;
-
-  target = udisks_object_peek_iscsi_target (window->current_object);
-  if (target == NULL)
-    {
-      g_warning ("Expected selected object to be an iSCSI target");
-      goto out;
-    }
-
-  active = !! gtk_switch_get_active (GTK_SWITCH (window->iscsi_connection_switch));
-  has_connections = !! iscsi_target_has_active_connections (target);
-  if (active != has_connections)
-    {
-      if (!has_connections)
-        {
-          const gchar *options[] = {NULL};
-          udisks_iscsi_target_call_login (target,
-                                          options,
-                                          "", /* portal_address */
-                                          0, /* portal_port */
-                                          "", /* interface_name */
-                                          NULL,  /* GCancellable* */
-                                          (GAsyncReadyCallback) iscsi_target_login_cb,
-                                          g_object_ref (window));
-        }
-      else
-        {
-          const gchar *options[] = {NULL};
-          udisks_iscsi_target_call_logout (target,
-                                           options,
-                                           "", /* portal_address */
-                                           0, /* portal_port */
-                                           "", /* interface_name */
-                                           NULL,  /* GCancellable* */
-                                           (GAsyncReadyCallback) iscsi_target_logout_cb,
-                                           g_object_ref (window));
-        }
-    }
-  gtk_switch_set_active (GTK_SWITCH (window->iscsi_connection_switch), has_connections);
-
- out:
-  ;
-}
-
-static void
-setup_iscsi_target_page (GduWindow    *window,
-                         UDisksObject *object)
-{
-  GtkTreeView *tree_view;
-  GduIScsiPathModel *model;
-  GtkTreeIter first_iter;
-
-  init_iscsi_target_page (window);
-
-  tree_view = GTK_TREE_VIEW (gdu_window_get_widget (window, "iscsi-connections-treeview"));
-  model = gdu_iscsi_path_model_new (window->client, object);
-  gtk_tree_view_set_model (tree_view, GTK_TREE_MODEL (model));
-  /* select the first row */
-  if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &first_iter))
-    gtk_tree_selection_select_iter (gtk_tree_view_get_selection (tree_view), &first_iter);
-  g_object_unref (model);
-}
-
-static void
-teardown_iscsi_target_page (GduWindow *window)
-{
-  GtkTreeView *tree_view;
-
-  tree_view = GTK_TREE_VIEW (gdu_window_get_widget (window, "iscsi-connections-treeview"));
-  gtk_tree_view_set_model (tree_view, NULL);
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
-static void
 on_volume_grid_changed (GduVolumeGrid  *grid,
                         gpointer        user_data)
 {



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