usr/src/cmd/gui-install/src/installation-disk-screen.c
author Alasdair Lumsden <al@everycity.co.uk>
Tue, 16 Aug 2011 20:54:07 +0000
branchoi_151a
changeset 1398 3cd5b2156d4c
parent 872 8b098e92c2a9
permissions -rw-r--r--
imported patch oi-branding-cmd-gui-install
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
     1
/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
     2
 * CDDL HEADER START
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
     3
 *
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
     5
 * Common Development and Distribution License (the "License").
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
     6
 * You may not use this file except in compliance with the License.
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
     7
 *
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    11
 * and limitations under the License.
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    12
 *
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    18
 *
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    19
 * CDDL HEADER END
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    20
 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    21
/*
872
8b098e92c2a9 6971257 Oracle branding for solaris express
Keith Mitchell <keith.mitchell@oracle.com>
parents: 782
diff changeset
    22
 * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    23
 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    24
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    25
#include <ctype.h>
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    26
#include <math.h>
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    27
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    28
#include <gnome.h>
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    29
#include "orchestrator-wrappers.h"
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    30
#include "callbacks.h"
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    31
#include "interface-globals.h"
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    32
#include "window-graphics.h"
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    33
#include "disk-block-order.h"
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    34
#include "installation-disk-screen.h"
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    35
#include "installation-profile.h"
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    36
#include "error-logging.h"
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    37
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    38
/* Uncomment these 2 lines to simulate Sparc behaviour on X86 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    39
/* #define __sparc */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    40
/* #undef __i386 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    41
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    42
#define	ONE_DECIMAL(x)	((round((x) * 10)) / 10.0)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    43
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    44
typedef enum {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    45
	DISK_STATUS_OK = 0,  /* Disk is fine for installation */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    46
	DISK_STATUS_CANT_PRESERVE, /* Partition table is unreadable */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    47
	DISK_STATUS_TOO_SMALL, /* Disk is too small - unusable */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    48
	DISK_STATUS_NO_MEDIA, /* If size (in kb or mb = 0) */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    49
	DISK_STATUS_NO_DISKINFO, /* Indicates target discovery error */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    50
	DISK_STATUS_WARNING, /* Disk warning error */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    51
	DISK_STATUS_LARGE_WARNING /* Disk > 2TB warning */
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    52
} DiskStatus;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    53
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    54
/* Num of target disks found, including unusable ones */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    55
static gint numdisks = 0;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    56
/* Currently selected disk */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    57
static gint activedisk = -1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    58
static gboolean activediskisreadable = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    59
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    60
static DiskStatus *alldiskstatus = NULL;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    61
/* Ptr array of all disks - linked lists suck for random access */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    62
static disk_info_t **alldiskinfo = NULL;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    63
/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    64
 * Original reference copy of actual disk layout
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    65
 * (or the default layout if unreadable)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    66
 */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    67
static disk_parts_t **originalpartitions = NULL;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    68
/* Working copy of the above. Customisations written here */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    69
static disk_parts_t **modifiedpartitions = NULL;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    70
/* Points to either one of the above */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    71
static disk_parts_t **proposedpartitions = NULL;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    72
/* A suggested layout that has one Solaris2 partition for the entire disk */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    73
static disk_parts_t **defaultpartitions = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    74
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    75
/* primaryblkorder and logicalblkorder for each disk */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    76
static DiskBlockOrder **originalprimaryblkorder;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    77
static DiskBlockOrder **modifiedprimaryblkorder;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    78
static DiskBlockOrder **originallogicalblkorder;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    79
static DiskBlockOrder **modifiedlogicalblkorder;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    80
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    81
/* Max Width of Disk Combos */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    82
static gint max_combo_width = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    83
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    84
/* Whether extended/logical Spinner has focus or not. */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    85
static gboolean spinner_has_focus = FALSE;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    86
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    87
/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    88
 * Signal handler id storage so we can easily block/unblock
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    89
 * the partitioning signal handlers that handle text insert
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    90
 * and delete events.
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
    91
 */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    92
static gulong spininserthandlers[FD_NUMPART] = {0, 0, 0, 0};
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    93
static gulong spindeletehandlers[FD_NUMPART] = {0, 0, 0, 0};
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    94
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    95
static GtkWidget *hbuttonbox;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    96
static GtkWidget **diskbuttons;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    97
static GtkAdjustment *viewportadjustment = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    98
static GtkWidget *scanningbox = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
    99
static GtkIconTheme *icontheme;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   100
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   101
/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   102
 * Partition type to string mappings.
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   103
 * Lifted straight out of fdisk.c
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   104
 */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   105
static char Ostr[] = "Other OS"; /* New in fdisk.c */
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   106
static char Dstr[] = "DOS12";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   107
static char D16str[] = "DOS16";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   108
static char DDstr[] = "DOS-DATA";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   109
static char EDstr[] = "EXT-DOS";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   110
static char DBstr[] = "DOS-BIG";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   111
static char PCstr[] = "PCIX";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   112
static char Ustr[] = "UNIX System";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   113
static char SUstr[] = "Solaris";
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   114
static char SU2str[] = "Solaris2";
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   115
static char X86str[] = "x86 Boot";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   116
static char DIAGstr[] = "Diagnostic";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   117
static char IFSstr[] = "IFS: NTFS";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   118
static char AIXstr[] = "AIX Boot";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   119
static char AIXDstr[] = "AIX Data";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   120
static char OS2str[] = "OS/2 Boot";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   121
static char WINstr[] = "Win95 FAT32";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   122
static char EWINstr[] = "Ext Win95";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   123
static char FAT95str[] = "FAT16 LBA";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   124
static char EXTLstr[] = "EXT LBA";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   125
static char LINUXstr[] = "Linux";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   126
static char CPMstr[] = "CP/M";
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   127
static char NOV2str[] = "Netware 286"; /* New in fdisk.c */
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   128
static char NOVstr[] = "Netware 3.x+";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   129
static char QNXstr[] = "QNX 4.x";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   130
static char QNX2str[] = "QNX part 2";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   131
static char QNX3str[] = "QNX part 3";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   132
static char LINNATstr[] = "Linux native";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   133
static char NTFSVOL1str[] = "NT volset 1";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   134
static char NTFSVOL2str[] = "NT volset 2";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   135
static char BSDstr[] = "BSD OS";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   136
static char NEXTSTEPstr[] = "NeXTSTEP";
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   137
static char BSDIFSstr[] = "BSDI FS";
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   138
static char BSDISWAPstr[] = "BSDI swap"; /* New in fdisk.c */
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   139
static char EFIstr[] = "EFI";
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   140
static char Actvstr[] = "Active";   /* New in fdisk.c */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   141
static char NAstr[] = "      "; /* New in fdisk.c */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   142
static char Unused[] = "Unused";
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   143
static char Extended[] = "Extended";
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   144
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   145
static gchar *WarningLabelMarkup = N_("<span size=\"smaller\"><span font_desc=\"Bold\">Warning: </span> The data in this partition will be erased.</span>");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   146
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   147
/* Forward declaration */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   148
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   149
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   150
disk_selection_set_active_disk(int disknum);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   151
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   152
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   153
disk_partitioning_set_from_parts_data(disk_info_t *diskinfo,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   154
	disk_parts_t *partitions);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   155
50
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
   156
static GtkWidget *
233
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
   157
create_diskbutton_icon(DiskStatus status, disk_info_t *diskinfo);
50
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
   158
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
   159
static void
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
   160
set_diskbutton_icon(GtkWidget *button, GtkWidget *image);
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
   161
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   162
static GtkWidget*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   163
disk_toggle_button_new_with_label(const gchar *label,
233
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
   164
	DiskStatus status, disk_info_t *diskinfo);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   165
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   166
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   167
disk_viewport_ui_init(GtkViewport *viewport);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   168
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   169
static gchar*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   170
disk_viewport_create_disk_tiptext(guint disknum);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   171
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   172
static gchar *
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   173
disk_viewport_create_disk_label(guint disknum);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   174
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   175
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   176
disk_viewport_diskbuttons_init(GtkViewport *viewport);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   177
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   178
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   179
disk_comboboxes_ui_init(void);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   180
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   181
static void
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   182
disk_comboboxes_ui_reset(void);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   183
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   184
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   185
disk_combobox_ui_init(GtkComboBox *combobox, gboolean is_primary);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   186
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   187
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   188
disk_combobox_ui_reset(GtkComboBox *combobox, gboolean is_primary);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   189
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   190
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   191
disk_partitioning_block_all_handlers(void);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   192
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   193
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   194
disk_partitioning_unblock_all_handlers(void);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   195
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   196
static void
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   197
disk_partitioning_block_combox_handler(guint partindex);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   198
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   199
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   200
disk_partitioning_unblock_combox_handler(guint partindex);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   201
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   202
static void
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   203
disk_partitioning_block_combobox_handlers(gint mask);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   204
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   205
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   206
disk_partitioning_unblock_combobox_handlers(gint mask);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   207
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   208
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   209
disk_partitioning_block_spinbox_handlers(gint mask);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   210
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   211
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   212
disk_partitioning_unblock_spinbox_handlers(gint mask);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   213
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   214
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   215
spinners_insert_text_filter(GtkEntry *widget,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   216
	const gchar *newtext,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   217
	gint length,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   218
	gint *position,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   219
	gpointer user_data);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   220
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   221
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   222
spinners_delete_text_filter(GtkEditable *widget,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   223
	gint start_pos,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   224
	gint end_pos,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   225
	gpointer user_data);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   226
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   227
static void
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   228
logical_spinners_insert_text_filter(GtkEntry *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   229
	const gchar *newtext,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   230
	gint length,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   231
	gint *position,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   232
	gpointer user_data);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   233
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   234
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   235
logical_spinners_delete_text_filter(GtkEditable *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   236
	gint start_pos,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   237
	gint end_pos,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   238
	gpointer user_data);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   239
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   240
static void
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   241
disk_partitioning_set_sensitive(gboolean sensitive);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   242
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   243
static gboolean
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   244
disk_partitioning_button_focus_handler(GtkWidget *widget,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   245
	GdkEventFocus *event,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   246
	gpointer user_data);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   247
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   248
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   249
viewport_adjustment_changed(GtkAdjustment *adjustment,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   250
	gpointer user_data);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   251
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   252
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   253
init_disk_status(void);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   254
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   255
static DiskStatus
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   256
get_disk_status(guint disknum);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   257
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   258
static disk_parts_t *
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   259
installation_disk_create_default_layout(disk_info_t *diskinfo);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   260
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   261
static gboolean
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   262
partition_discovery_monitor(gpointer user_data);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   263
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   264
static void
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   265
update_disk_partitions_from_ui(disk_parts_t *partitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   266
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   267
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   268
update_logical_disk_partitions_from_ui(disk_parts_t *partitions);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   269
233
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
   270
static gboolean
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
   271
disk_is_too_big(disk_info_t *diskinfo);
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
   272
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   273
static gint
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   274
get_max_cell_renderer_width(void);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   275
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   276
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   277
reset_primary_partitions(gboolean block_handlers);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   278
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   279
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   280
initialize_default_partition_layout(gint disknum);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   281
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   282
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   283
logical_partition_spinner_value_changed(GtkWidget *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   284
	gpointer user_data);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   285
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   286
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   287
logical_partition_combo_changed(GtkWidget *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   288
	gpointer user_data);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   289
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   290
static gboolean
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   291
logical_partition_spinner_focus_in_handler(GtkWidget *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   292
	GdkEventFocus *event,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   293
	gpointer user_data);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   294
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   295
static gboolean
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   296
logical_partition_spinner_focus_out_handler(GtkWidget *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   297
	GdkEventFocus *event,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   298
	gpointer user_data);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   299
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   300
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   301
set_logical_combo_sensitivity(gint pidx,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   302
	gboolean sensitivity,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   303
	gboolean set_all);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   304
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   305
static gfloat
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   306
calculate_avail_space(DiskBlockOrder *startblkorder,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   307
	gint partindex,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   308
	partition_info_t *partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   309
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   310
static LogicalPartition *
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   311
get_logical_partition_at_pos(gint index,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   312
	LogicalPartition *startlogical);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   313
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   314
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   315
restore_unused_partitions(guint disk_num, disk_parts_t *partitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   316
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   317
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   318
update_primary_unused_partition_size_from_ui(disk_parts_t *partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   319
	gint pidx,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   320
	gfloat diffgb);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   321
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   322
static gfloat
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   323
get_extended_partition_min_size(disk_parts_t *partitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   324
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   325
/* Real Glade XML referenced callbacks */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   326
void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   327
installationdisk_wholediskradio_toggled(GtkWidget *widget, gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   328
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   329
#if defined(__i386)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   330
	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) == FALSE)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   331
		return;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   332
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   333
	proposedpartitions[activedisk] = defaultpartitions[activedisk];
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   334
	gtk_widget_hide(
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   335
	    MainWindow.InstallationDiskWindow.custompartitioningvbox);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   336
	gtk_widget_show(
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   337
	    MainWindow.InstallationDiskWindow.diskwarninghbox);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   338
#endif
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   339
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   340
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   341
void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   342
installationdisk_partitiondiskradio_toggled(GtkWidget *widget,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   343
	gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   344
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   345
#if defined(__i386)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   346
	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) == FALSE)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   347
		return;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   348
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   349
	proposedpartitions[activedisk] = modifiedpartitions[activedisk];
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   350
	gtk_widget_hide(
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   351
	    MainWindow.InstallationDiskWindow.diskwarninghbox);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   352
	gtk_widget_show(
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   353
	    MainWindow.InstallationDiskWindow.custompartitioningvbox);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   354
#endif
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   355
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   356
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   357
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   358
show_warning_message(GtkWidget *warning, gboolean show)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   359
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   360
	if (show == TRUE)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   361
		gtk_widget_show(warning);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   362
	else
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   363
		gtk_widget_hide(warning);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   364
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   365
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   366
static void
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   367
update_logical_data_loss_warnings(LogicalPartition *startlogical)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   368
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   369
	LogicalPartition *curlogical;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   370
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   371
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   372
	 * Cycle throught all logical partitions, showing/hiding
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   373
	 * Warning box as appropriate
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   374
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   375
	for (curlogical = startlogical;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   376
	    curlogical != NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   377
	    curlogical = curlogical->next) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   378
		if (curlogical->sizechange || curlogical->typechange) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   379
			show_warning_message(curlogical->warningbox, TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   380
		} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   381
			show_warning_message(curlogical->warningbox, FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   382
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   383
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   384
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   385
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   386
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   387
update_data_loss_warnings(void)
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   388
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   389
	gint i = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   390
	static GtkWidget **warnings = NULL;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   391
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   392
	if (!warnings) {
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   393
		warnings = g_new0(GtkWidget *, FD_NUMPART);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   394
		for (i = 0; i < FD_NUMPART; i++)
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   395
			warnings[i] =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   396
			    MainWindow.InstallationDiskWindow.partwarnbox[i];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   397
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   398
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   399
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   400
	 * Cycle through primary paritions, if partition type or size has
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   401
	 * changed then show warning message
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   402
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   403
	for (i = 0; i < FD_NUMPART; i++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   404
		if (MainWindow.InstallationDiskWindow.parttypechanges[i] ||
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   405
		    MainWindow.InstallationDiskWindow.partsizechanges[i]) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   406
			show_warning_message(warnings[i], TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   407
		} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   408
			show_warning_message(warnings[i], FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   409
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   410
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   411
		/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   412
		 * If there is logical partitions defined, cycle through these
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   413
		 * And update warnings if type or size have changed here aswell
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   414
		 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   415
		if (MainWindow.InstallationDiskWindow.startlogical[i] != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   416
			update_logical_data_loss_warnings(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   417
			    MainWindow.InstallationDiskWindow.startlogical[i]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   418
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   419
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   420
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   421
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   422
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   423
set_range_avail_from_value(GtkSpinButton *spinner,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   424
	GtkLabel *availlabel,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   425
	gfloat fromval,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   426
	gfloat toval)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   427
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   428
	gchar *sizestr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   429
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   430
	if (spinner == NULL && availlabel == NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   431
		return;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   432
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   433
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   434
	sizestr = g_strdup_printf("%.1f", toval);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   435
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   436
	if (spinner != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   437
		gtk_spin_button_set_range(spinner, fromval,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   438
		    fromval == 0 ? 0 : strtod(sizestr, NULL));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   439
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   440
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   441
	if (availlabel != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   442
		gtk_label_set_text(availlabel, sizestr);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   443
		gtk_widget_show(GTK_WIDGET(availlabel));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   444
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   445
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   446
	g_free(sizestr);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   447
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   448
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   449
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   450
set_size_widgets_from_value(GtkSpinButton *spinner,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   451
	GtkLabel *availlabel,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   452
	gfloat size)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   453
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   454
	gchar *sizestr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   455
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   456
	if (spinner == NULL && availlabel == NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   457
		return;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   458
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   459
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   460
	sizestr = g_strdup_printf("%.1f", size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   461
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   462
	if (spinner != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   463
		gtk_spin_button_set_value(spinner, strtod(sizestr, NULL));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   464
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   465
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   466
	if (availlabel != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   467
		gtk_label_set_text(availlabel, sizestr);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   468
		gtk_widget_show(GTK_WIDGET(availlabel));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   469
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   470
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   471
	g_free(sizestr);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   472
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   473
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   474
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   475
logical_partition_init(guint pidx,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   476
	LogicalPartition *logicalpartition,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   477
	gint top_attach,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   478
	gint bottom_attach)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   479
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   480
	g_return_if_fail(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   481
	    MainWindow.InstallationDiskWindow.numpartlogical[pidx] > 0);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   482
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   483
	/* Create type alignment */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   484
	logicalpartition->typealign = gtk_alignment_new(0.5, 0.5, 1.0, 1.0);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   485
	gtk_alignment_set_padding(GTK_ALIGNMENT(logicalpartition->typealign),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   486
	    0,		/* Top Padding */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   487
	    0,		/* Bottom Padding */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   488
	    LOGICAL_COMBOBOX_INDENT,		/* Left Padding */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   489
	    0);		/* Right Padding */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   490
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   491
	/* Create and initialize type combo */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   492
	logicalpartition->typecombo = gtk_combo_box_new();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   493
	disk_combobox_ui_init(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   494
	    GTK_COMBO_BOX(logicalpartition->typecombo), FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   495
	logicalpartition->partcombosaved = UNUSED_PARTITION;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   496
	logicalpartition->combochangehandler = g_signal_connect(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   497
	    G_OBJECT(logicalpartition->typecombo),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   498
	    "changed",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   499
	    G_CALLBACK(logical_partition_combo_changed),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   500
	    logicalpartition);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   501
	g_signal_handler_block(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   502
	    (gpointer *)logicalpartition->typecombo,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   503
	    logicalpartition->combochangehandler);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   504
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   505
	if (spinner_has_focus == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   506
		gtk_widget_set_sensitive(logicalpartition->typecombo, FALSE);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   507
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   508
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   509
	/* Pack type combo into type alignment container */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   510
	gtk_container_add(GTK_CONTAINER(logicalpartition->typealign),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   511
	    logicalpartition->typecombo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   512
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   513
	/* pack type alignment container into fdisktable */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   514
	gtk_table_attach(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   515
	    GTK_TABLE(MainWindow.InstallationDiskWindow.fdisktable),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   516
	    logicalpartition->typealign,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   517
	    0,			/* Left Attach */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   518
	    1,			/* Right Attach */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   519
	    top_attach, /* Top attach */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   520
	    bottom_attach,	/* Bottom Attach */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   521
	    GTK_FILL,	/* Horizontal Options */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   522
	    0,			/* Vertical Options */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   523
	    0,			/* XPadding */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   524
	    0);			/* YPadding */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   525
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   526
	/* Create size spinner */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   527
	logicalpartition->sizespinner = gtk_spin_button_new(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   528
	    GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 1.0, 1.0, 0.0, 0.0)),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   529
	    0.10,	/* Climb Rate */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   530
	    1);		/* Digits */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   531
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   532
	/* Added value changed signal handler */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   533
	logicalpartition->spinnerchangehandler = g_signal_connect(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   534
	    G_OBJECT(logicalpartition->sizespinner),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   535
	    "value_changed",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   536
	    G_CALLBACK(logical_partition_spinner_value_changed),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   537
	    logicalpartition);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   538
	logicalpartition->spinnerinserthandler = g_signal_connect(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   539
	    G_OBJECT(logicalpartition->sizespinner),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   540
	    "insert-text",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   541
	    G_CALLBACK(logical_spinners_insert_text_filter),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   542
	    logicalpartition);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   543
	logicalpartition->spinnerdeletehandler = g_signal_connect(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   544
	    G_OBJECT(logicalpartition->sizespinner),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   545
	    "delete-text",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   546
	    G_CALLBACK(logical_spinners_delete_text_filter),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   547
	    logicalpartition);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   548
	g_signal_connect(G_OBJECT(logicalpartition->sizespinner),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   549
	    "focus-in-event",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   550
	    G_CALLBACK(logical_partition_spinner_focus_in_handler),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   551
	    logicalpartition);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   552
	g_signal_connect(G_OBJECT(logicalpartition->sizespinner),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   553
	    "focus-out-event",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   554
	    G_CALLBACK(logical_partition_spinner_focus_out_handler),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   555
	    logicalpartition);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   556
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   557
	g_signal_handler_block(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   558
	    (gpointer *)logicalpartition->sizespinner,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   559
	    logicalpartition->spinnerchangehandler);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   560
	g_signal_handler_block(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   561
	    (gpointer *)logicalpartition->sizespinner,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   562
	    logicalpartition->spinnerinserthandler);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   563
	g_signal_handler_block(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   564
	    (gpointer *)logicalpartition->sizespinner,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   565
	    logicalpartition->spinnerdeletehandler);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   566
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   567
	gtk_spin_button_set_range(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   568
	    GTK_SPIN_BUTTON(logicalpartition->sizespinner),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   569
	    0, 0);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   570
	gtk_spin_button_set_value(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   571
	    GTK_SPIN_BUTTON(logicalpartition->sizespinner),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   572
	    0);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   573
	gtk_widget_set_sensitive(logicalpartition->sizespinner, FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   574
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   575
	/* pack size spinner into fdisktable */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   576
	gtk_table_attach(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   577
	    GTK_TABLE(MainWindow.InstallationDiskWindow.fdisktable),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   578
	    logicalpartition->sizespinner,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   579
	    1,			/* Left Attach */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   580
	    2,			/* Right Attach */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   581
	    top_attach, /* Top attach */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   582
	    bottom_attach,	/* Bottom Attach */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   583
	    GTK_FILL,	/* Horizontal Options */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   584
	    0,			/* Vertical Options */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   585
	    0,			/* XPadding */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   586
	    0);			/* YPadding */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   587
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   588
	/* Create size avail label */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   589
	logicalpartition->availlabel = gtk_label_new("0.0");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   590
	gtk_label_set_justify(GTK_LABEL(logicalpartition->availlabel),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   591
	    GTK_JUSTIFY_RIGHT);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   592
	gtk_misc_set_alignment(GTK_MISC(logicalpartition->availlabel),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   593
	    0.0, 0.5);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   594
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   595
	/* pack size avail label into fdisktable */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   596
	gtk_table_attach(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   597
	    GTK_TABLE(MainWindow.InstallationDiskWindow.fdisktable),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   598
	    logicalpartition->availlabel,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   599
	    2,			/* Left Attach */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   600
	    3,			/* Right Attach */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   601
	    top_attach, /* Top attach */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   602
	    bottom_attach,	/* Bottom Attach */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   603
	    GTK_FILL,	/* Horizontal Options */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   604
	    GTK_FILL,	/* Vertical Options */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   605
	    0,			/* XPadding */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   606
	    0);			/* YPadding */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   607
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   608
	/* Create warning hbox container */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   609
	logicalpartition->warningbox = gtk_hbox_new(FALSE, 5);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   610
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   611
	/* Create warning image */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   612
	logicalpartition->warningimage = gtk_image_new_from_stock(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   613
	    GTK_STOCK_DIALOG_WARNING,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   614
	    GTK_ICON_SIZE_MENU);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   615
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   616
	/* Create warning label */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   617
	logicalpartition->warninglabel = gtk_label_new(_(WarningLabelMarkup));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   618
	gtk_label_set_use_markup(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   619
	    GTK_LABEL(logicalpartition->warninglabel), TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   620
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   621
	/* Pack warning image and warning label into warning hbox container */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   622
	gtk_box_pack_start(GTK_BOX(logicalpartition->warningbox),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   623
	    logicalpartition->warningimage,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   624
	    FALSE,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   625
	    FALSE,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   626
	    0);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   627
	gtk_box_pack_start(GTK_BOX(logicalpartition->warningbox),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   628
	    logicalpartition->warninglabel,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   629
	    FALSE,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   630
	    FALSE,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   631
	    0);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   632
	gtk_widget_show(logicalpartition->warningimage);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   633
	gtk_widget_show(logicalpartition->warninglabel);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   634
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   635
	/* Pack warning hbox container into fdisktable */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   636
	gtk_table_attach(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   637
	    GTK_TABLE(MainWindow.InstallationDiskWindow.fdisktable),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   638
	    logicalpartition->warningbox,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   639
	    3,			/* Left Attach */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   640
	    4,			/* Right Attach */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   641
	    top_attach, /* Top attach */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   642
	    bottom_attach,	/* Bottom Attach */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   643
	    GTK_FILL,	/* Horizontal Options */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   644
	    GTK_FILL,	/* Vertical Options */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   645
	    0,			/* XPadding */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   646
	    0);			/* YPadding */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   647
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   648
	/* Show all the widgets */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   649
	gtk_widget_show_all(logicalpartition->typealign);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   650
	gtk_widget_show_all(logicalpartition->sizespinner);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   651
	gtk_widget_show_all(logicalpartition->availlabel);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   652
	gtk_widget_hide(logicalpartition->warningbox);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   653
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   654
	logicalpartition->sizechange = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   655
	logicalpartition->typechange = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   656
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   657
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   658
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   659
resize_fdisk_table(guint num_rows)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   660
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   661
	MainWindow.InstallationDiskWindow.fdisktablerows += num_rows;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   662
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   663
	gtk_table_resize(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   664
	    GTK_TABLE(MainWindow.InstallationDiskWindow.fdisktable),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   665
	    MainWindow.InstallationDiskWindow.fdisktablerows,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   666
	    4);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   667
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   668
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   669
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   670
relocate_widget(GtkWidget *container,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   671
	GtkWidget *child,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   672
	guint top_attach,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   673
	guint bottom_attach)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   674
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   675
	GValue gvalue_top_attach = {0};
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   676
	GValue gvalue_bottom_attach = {0};
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   677
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   678
	g_value_init(&gvalue_top_attach, G_TYPE_INT);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   679
	g_value_init(&gvalue_bottom_attach, G_TYPE_INT);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   680
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   681
	g_value_set_int(&gvalue_top_attach, top_attach);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   682
	g_value_set_int(&gvalue_bottom_attach, bottom_attach);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   683
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   684
	gtk_container_child_set_property(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   685
	    GTK_CONTAINER(container),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   686
	    child,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   687
	    "top-attach",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   688
	    &gvalue_top_attach);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   689
	gtk_container_child_set_property(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   690
	    GTK_CONTAINER(container),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   691
	    child,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   692
	    "bottom-attach",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   693
	    &gvalue_bottom_attach);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   694
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   695
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   696
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   697
relocate_static_widgets(guint totalrows)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   698
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   699
	/* Relocate Reset Button */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   700
	relocate_widget(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   701
	    MainWindow.InstallationDiskWindow.fdisktable,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   702
	    MainWindow.InstallationDiskWindow.resetbutton,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   703
	    totalrows-1,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   704
	    totalrows);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   705
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   706
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   707
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   708
relocate_logical_widgets(LogicalPartition *curpartlogical,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   709
	guint logical_attach)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   710
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   711
	relocate_widget(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   712
	    MainWindow.InstallationDiskWindow.fdisktable,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   713
	    curpartlogical->typealign,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   714
	    logical_attach,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   715
	    logical_attach+1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   716
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   717
	relocate_widget(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   718
	    MainWindow.InstallationDiskWindow.fdisktable,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   719
	    curpartlogical->sizespinner,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   720
	    logical_attach,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   721
	    logical_attach+1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   722
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   723
	relocate_widget(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   724
	    MainWindow.InstallationDiskWindow.fdisktable,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   725
	    curpartlogical->availlabel,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   726
	    logical_attach,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   727
	    logical_attach+1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   728
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   729
	relocate_widget(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   730
	    MainWindow.InstallationDiskWindow.fdisktable,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   731
	    curpartlogical->warningbox,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   732
	    logical_attach,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   733
	    logical_attach+1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   734
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   735
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   736
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   737
relocate_partition_widgets(guint pidx, guint num_rows)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   738
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   739
	guint i = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   740
	LogicalPartition *curpartlogical = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   741
	guint partlogicals = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   742
	guint logical_attach = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   743
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   744
	/* Primary partitions located from 0->3 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   745
	for (i = pidx+1; i < FD_NUMPART; i++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   746
		/* Increase row number of this primary partition */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   747
		MainWindow.InstallationDiskWindow.partrow[i] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   748
		    MainWindow.InstallationDiskWindow.partrow[i]+num_rows;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   749
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   750
		/* Has this primary got any logical children */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   751
		if (MainWindow.InstallationDiskWindow.startlogical[i] != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   752
			/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   753
			 * Loop through all children and shift down by num_rows
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   754
			 * The row to which this logical is attached is calculated
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   755
			 * MainWindow.InstallationDiskWindow.partrow[i], which has
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   756
			 * been adjusted already by num_rows.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   757
			 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   758
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   759
			partlogicals = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   760
			curpartlogical =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   761
			    MainWindow.InstallationDiskWindow.startlogical[i];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   762
			for (; curpartlogical != NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   763
			    curpartlogical = curpartlogical->next) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   764
				partlogicals = partlogicals + 1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   765
				logical_attach =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   766
				    MainWindow.InstallationDiskWindow.partrow[i] +
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   767
				    partlogicals;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   768
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   769
				relocate_logical_widgets(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   770
				    curpartlogical, logical_attach);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   771
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   772
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   773
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   774
		/* partcombo[pidx] */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   775
		relocate_widget(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   776
		    MainWindow.InstallationDiskWindow.fdisktable,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   777
		    MainWindow.InstallationDiskWindow.partcombo[i],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   778
		    MainWindow.InstallationDiskWindow.partrow[i],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   779
		    MainWindow.InstallationDiskWindow.partrow[i]+1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   780
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   781
		/* partspin[pidx] */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   782
		relocate_widget(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   783
		    MainWindow.InstallationDiskWindow.fdisktable,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   784
		    MainWindow.InstallationDiskWindow.partspin[i],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   785
		    MainWindow.InstallationDiskWindow.partrow[i],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   786
		    MainWindow.InstallationDiskWindow.partrow[i]+1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   787
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   788
		/* partavail[pidx] */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   789
		relocate_widget(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   790
		    MainWindow.InstallationDiskWindow.fdisktable,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   791
		    MainWindow.InstallationDiskWindow.partavail[i],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   792
		    MainWindow.InstallationDiskWindow.partrow[i],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   793
		    MainWindow.InstallationDiskWindow.partrow[i]+1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   794
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   795
		/* partwarnbox[pidx] */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   796
		relocate_widget(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   797
		    MainWindow.InstallationDiskWindow.fdisktable,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   798
		    MainWindow.InstallationDiskWindow.partwarnbox[i],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   799
		    MainWindow.InstallationDiskWindow.partrow[i],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   800
		    MainWindow.InstallationDiskWindow.partrow[i]+1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   801
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   802
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   803
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   804
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   805
relocate_extended_widgets(gint pidx,	/* Primary pinfo index 0-3 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   806
	gint lidx,	/* Index into startlogicals  0-N */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   807
	gint num_rows)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   808
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   809
	guint i = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   810
	LogicalPartition *curpartlogical = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   811
	guint partlogidx = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   812
	guint top_attach = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   813
	guint initial_top_attach = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   814
	guint bottom_attach = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   815
	gint log_partrow = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   816
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   817
	/* Relocate logical partitions starting at lidx+1 up to last logical */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   818
	/* by number of num_rows */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   819
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   820
	if (MainWindow.InstallationDiskWindow.startlogical[pidx] != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   821
		/* Loop through all children until we get to lidx item */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   822
		partlogidx = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   823
		curpartlogical =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   824
		    MainWindow.InstallationDiskWindow.startlogical[pidx];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   825
		for (; curpartlogical != NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   826
		    curpartlogical = curpartlogical->next) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   827
			if (partlogidx > lidx) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   828
				log_partrow =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   829
				    MainWindow.InstallationDiskWindow.partrow[pidx] +
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   830
				    partlogidx + 1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   831
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   832
				top_attach = log_partrow + num_rows;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   833
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   834
				relocate_logical_widgets(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   835
				    curpartlogical, top_attach);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   836
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   837
			partlogidx = partlogidx + 1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   838
		}
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   839
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   840
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   841
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
   842
static void
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   843
logical_partition_destroy_ui(LogicalPartition *rmlogical)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   844
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   845
	g_return_if_fail(rmlogical != NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   846
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   847
	gtk_widget_destroy(rmlogical->typecombo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   848
	gtk_widget_destroy(rmlogical->typealign);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   849
	gtk_widget_destroy(rmlogical->sizespinner);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   850
	gtk_widget_destroy(rmlogical->availlabel);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   851
	gtk_widget_destroy(rmlogical->warningimage);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   852
	gtk_widget_destroy(rmlogical->warninglabel);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   853
	gtk_widget_destroy(rmlogical->warningbox);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   854
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   855
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   856
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   857
logical_partitions_destroy_ui(LogicalPartition *startlogical)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   858
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   859
	LogicalPartition *curlogical;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   860
	LogicalPartition *logicaltofree;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   861
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   862
	for (curlogical = startlogical; curlogical != NULL; ) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   863
		logical_partition_destroy_ui(curlogical);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   864
		logicaltofree = curlogical;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   865
		curlogical = curlogical->next;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   866
		g_free(logicaltofree);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   867
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   868
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   869
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   870
static DiskBlockOrder *
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   871
logical_partition_remove(disk_parts_t *partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   872
	DiskBlockOrder *rmblkorder,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   873
	gboolean ret_next_item)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   874
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   875
	gint lidx = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   876
	partition_info_t *partinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   877
	DiskBlockOrder *retblkorder;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   878
	gboolean moditem_found = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   879
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   880
	/* Firstly reset element in modifiedpartitions[activedisk] */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   881
	/* Collapse logicals down to remove this single item */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   882
	for (lidx = FD_NUMPART; lidx < OM_NUMPART; lidx++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   883
		partinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   884
		    orchestrator_om_get_part_by_blkorder(partitions, lidx);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   885
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   886
		if (moditem_found == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   887
			if (partinfo) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   888
				partitions->pinfo[lidx] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   889
				    partitions->pinfo[lidx+1];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   890
				if (partitions->pinfo[lidx].partition_order > 0)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   891
					partitions->pinfo[lidx].partition_order--;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   892
			} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   893
				break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   894
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   895
		} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   896
			if (partinfo && partinfo->partition_id ==
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   897
			    rmblkorder->partinfo.partition_id) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   898
				moditem_found = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   899
				partitions->pinfo[lidx] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   900
				    partitions->pinfo[lidx+1];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   901
				if (partitions->pinfo[lidx].partition_order > 0)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   902
					partitions->pinfo[lidx].partition_order--;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   903
			} else if (!partinfo) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   904
				break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   905
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   906
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   907
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   908
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   909
	/* Remove blkorder item for this logical */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   910
	retblkorder = installationdisk_blkorder_remove(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   911
	    FALSE,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   912
	    &modifiedlogicalblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   913
	    rmblkorder,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   914
	    ret_next_item);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   915
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   916
	/* Return the next/prev blkorder, after this one was removed */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   917
	return (retblkorder);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   918
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   919
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   920
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   921
logical_partition_remove_ui(disk_parts_t *partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   922
	partition_info_t *rmpartinfo,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   923
	gint pidx, /* Primary partition display index 0-3 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   924
	gint lidx) /* Logical indx into startlogical of item to remove, 0-N */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   925
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   926
	LogicalPartition *curlogical = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   927
	LogicalPartition *prevlogical = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   928
	gint idx = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   929
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   930
	/* Get matching logicalpart in this primary partitions */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   931
	/* linked list of logical partitions */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   932
	/* Destroy widgets, and remove from linked list of logicalparts */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   933
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   934
	/* Relocate existing logical partitions greater */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   935
	/* than one being removed */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   936
	relocate_extended_widgets(pidx, lidx, -1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   937
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   938
	/* Get logicalpart starting point */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   939
	curlogical = MainWindow.InstallationDiskWindow.startlogical[pidx];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   940
	g_return_if_fail(curlogical != NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   941
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   942
	/* Cycle through until we get to matching index then free this item */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   943
	for (; curlogical != NULL; curlogical = curlogical->next, idx++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   944
		if (idx == lidx) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   945
			if (idx == 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   946
				/* At start of the list */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   947
				MainWindow.InstallationDiskWindow.startlogical[pidx] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   948
				    curlogical->next;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   949
			} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   950
				prevlogical->next = curlogical->next;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   951
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   952
			logical_partition_destroy_ui(curlogical);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   953
			g_free(curlogical);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   954
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   955
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   956
		prevlogical = curlogical;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   957
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   958
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   959
	/* Need to reset logpartindex's in items after the one that was */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   960
	/* removed */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   961
	if (idx <= 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   962
		curlogical =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   963
		    MainWindow.InstallationDiskWindow.startlogical[pidx];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   964
	} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   965
		curlogical = prevlogical->next;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   966
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   967
	for (; curlogical != NULL; curlogical = curlogical->next) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   968
		curlogical->logpartindex--;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   969
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   970
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   971
	/* Relocate primary partitions if necessary */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   972
	relocate_partition_widgets(pidx, -1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   973
	relocate_static_widgets(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   974
	    MainWindow.InstallationDiskWindow.fdisktablerows-1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   975
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   976
	/* Resize Fdisk table by -1 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   977
	resize_fdisk_table(-1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   978
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   979
	/* Reduce numpartlogical, and possible reset startlogical */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   980
	MainWindow.InstallationDiskWindow.numpartlogical[pidx] -= 1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   981
	if (MainWindow.InstallationDiskWindow.numpartlogical[pidx]  == 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   982
		MainWindow.InstallationDiskWindow.startlogical[pidx] = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   983
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   984
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   985
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   986
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   987
logical_partitions_remove_all()
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   988
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   989
	DiskBlockOrder *curblkorder = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   990
	DiskBlockOrder *tmpblkorder = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   991
	gint partindex;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   992
	partition_info_t *partinfo;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   993
	disk_parts_t *partitions;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   994
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   995
	/* Remove logical elements from blkorder linked list */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   996
	installationdisk_blkorder_free_list(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   997
	    modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   998
	modifiedlogicalblkorder[activedisk] = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
   999
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1000
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1001
	 * Process modifiedpartions elements for all logicals and
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1002
	 * reset them back default values
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1003
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1004
	partitions = modifiedpartitions[activedisk];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1005
	for (partindex = FD_NUMPART; partindex < OM_NUMPART; partindex++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1006
		partinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1007
		    orchestrator_om_get_part_by_blkorder(partitions, partindex);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1008
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1009
		if (partinfo) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1010
			/* Set this partition_info to 0's and defaults */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1011
			orchestrator_om_set_partition_info(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1012
			    partinfo, 0, 0, 0, 0);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1013
		} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1014
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1015
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1016
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1017
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1018
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1019
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1020
logical_partitions_remove_all_ui(guint partindex)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1021
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1022
	/* Destroy all logical widgets and relocate other widges up */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1023
	logical_partitions_destroy_ui(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1024
	    MainWindow.InstallationDiskWindow.startlogical[partindex]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1025
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1026
	/* relocate_primary_partitions */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1027
	relocate_partition_widgets(partindex,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1028
	    MainWindow.InstallationDiskWindow.numpartlogical[partindex]*-1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1029
	relocate_static_widgets(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1030
	    MainWindow.InstallationDiskWindow.fdisktablerows-1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1031
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1032
	/* Reduce fdisk table by number of logical disks */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1033
	resize_fdisk_table(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1034
	    MainWindow.InstallationDiskWindow.numpartlogical[partindex]*-1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1035
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1036
	/* Initialize startlogical, and numpartlogical */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1037
	MainWindow.InstallationDiskWindow.startlogical[partindex] = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1038
	MainWindow.InstallationDiskWindow.numpartlogical[partindex] = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1039
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1040
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1041
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1042
revert_partcombo_value(guint partindex)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1043
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1044
	disk_partitioning_block_combox_handler(partindex);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1045
	gtk_combo_box_set_active(GTK_COMBO_BOX(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1046
	    MainWindow.InstallationDiskWindow.partcombo[partindex]),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1047
	    MainWindow.InstallationDiskWindow.partcombosaved[partindex]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1048
	disk_partitioning_unblock_combox_handler(partindex);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1049
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1050
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1051
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1052
logicalpart_append(LogicalPartition *startlogical,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1053
	LogicalPartition *newlogical)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1054
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1055
	LogicalPartition *curlogical;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1056
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1057
	for (curlogical = startlogical;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1058
	    curlogical != NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1059
	    curlogical = curlogical->next) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1060
		if (curlogical->next == NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1061
			curlogical->next = newlogical;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1062
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1063
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1064
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1065
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1066
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1067
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1068
logicalpart_insert_after(LogicalPartition *startlogical,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1069
	gint lidx,			/* Index into pinfo[] 4->35 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1070
	LogicalPartition *newlogical)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1071
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1072
	LogicalPartition *curlogical;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1073
	gint logindex = FD_NUMPART-1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1074
	gboolean incrementing = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1075
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1076
	for (curlogical = startlogical;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1077
	    curlogical != NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1078
	    curlogical = curlogical->next) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1079
		logindex++;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1080
		if (logindex == lidx) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1081
			newlogical->next = curlogical->next;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1082
			curlogical->next = newlogical;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1083
			newlogical->logpartindex = curlogical->logpartindex+1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1084
		} else if (curlogical == newlogical) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1085
			incrementing = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1086
		} else if (incrementing == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1087
			curlogical->logpartindex++;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1088
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1089
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1090
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1091
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1092
/* Paramaters */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1093
/* lidx : Index into pinfo[] 4->35 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1094
/* blkorder : If blkorder item is displayed or not */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1095
static partition_info_t *
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1096
create_logical_partition(gint lidx,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1097
	gboolean displayed)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1098
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1099
	partition_info_t *partinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1100
	partition_info_t *logpartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1101
	disk_parts_t *partitions;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1102
	DiskBlockOrder *newblkorder;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1103
	DiskBlockOrder *curblkorder;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1104
	uint8_t partition_order = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1105
	gint tidx = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1106
	gboolean inserting = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1107
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1108
	partitions = modifiedpartitions[activedisk];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1109
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1110
	/* If lidx is negative, get the last logical as we are appending */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1111
	/* to end of logicals, lidx is index into pinfo e.g. 4->35 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1112
	if (lidx == -1) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1113
		/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1114
		 * cycle through all logical partinfos, getting last index
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1115
		 * Add 1 to get next unused order item, this will return
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1116
		 * FD_NUMPART-1 if none exist.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1117
		 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1118
		lidx = orchestrator_om_get_last_logical_index(partitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1119
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1120
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1121
	logpartinfo = orchestrator_om_get_part_by_blkorder(partitions, lidx);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1122
	if (logpartinfo != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1123
		/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1124
		 * Item already exists at this order point in array, therefore
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1125
		 * we are inserting into the array after this point, cycle
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1126
		 * through remainer items in modifiedpartitions shifting them
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1127
		 * down one place and popping a new item in.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1128
		 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1129
		inserting = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1130
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1131
		tidx = orchestrator_om_get_last_logical_index(partitions)+1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1132
		for (; tidx > lidx+1; tidx--) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1133
			partitions->pinfo[tidx] = partitions->pinfo[tidx-1];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1134
			partitions->pinfo[tidx].partition_order++;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1135
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1136
		orchestrator_om_set_partition_info(&partitions->pinfo[lidx+1],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1137
		    0, 0, 0, 0);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1138
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1139
		/* set modifiedpartitiond[] logical item to next unused pid */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1140
		partinfo = orchestrator_om_find_unused_logical_partition(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1141
		    partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1142
		    UNUSED, lidx+1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1143
	} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1144
		/* set modifiedpartitiond[] logical item to next unused pid */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1145
		partinfo = orchestrator_om_find_unused_logical_partition(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1146
		    partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1147
		    UNUSED, lidx);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1148
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1149
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1150
	if (partinfo) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1151
		/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1152
		 * Ensure we have an entry in modifiedblkorder[activedisk]
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1153
		 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1154
		newblkorder = g_new0(DiskBlockOrder, 1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1155
		newblkorder->displayed = displayed;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1156
		newblkorder->next = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1157
		(void) memcpy(&newblkorder->partinfo, partinfo,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1158
		    sizeof (partition_info_t));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1159
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1160
		if (modifiedlogicalblkorder[activedisk] == NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1161
			modifiedlogicalblkorder[activedisk] = newblkorder;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1162
			curblkorder = modifiedlogicalblkorder[activedisk];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1163
		} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1164
			if (inserting == FALSE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1165
				/* Add new logical to end of blkorder list */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1166
				curblkorder = installationdisk_blkorder_getlast(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1167
				    modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1168
				installationdisk_blkorder_insert_after(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1169
				    modifiedlogicalblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1170
				    curblkorder, newblkorder, FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1171
				curblkorder = newblkorder;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1172
			} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1173
				/* Insering new item into curblkorder list */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1174
				curblkorder =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1175
				    installationdisk_blkorder_get_by_partition_order(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1176
				    modifiedlogicalblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1177
				    lidx+1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1178
				g_assert(curblkorder);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1179
				installationdisk_blkorder_insert_after(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1180
				    modifiedlogicalblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1181
				    curblkorder, newblkorder, TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1182
				curblkorder = newblkorder;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1183
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1184
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1185
		return (partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1186
	} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1187
		return (NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1188
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1189
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1190
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1191
static LogicalPartition *
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1192
create_logical_partition_ui(gint pidx,	/* Primary pinfo[] index 0-3 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1193
	gint lidx,	/* Logical pinfo[] index 4->35 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1194
	gboolean appendatend)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1195
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1196
	LogicalPartition *newlogicalpart = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1197
	guint top_attach = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1198
	guint bottom_attach = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1199
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1200
	if (MainWindow.InstallationDiskWindow.startlogical[pidx] == NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1201
		MainWindow.InstallationDiskWindow.numpartlogical[pidx] = 1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1202
	} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1203
		MainWindow.InstallationDiskWindow.numpartlogical[pidx] += 1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1204
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1205
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1206
	/* Add extra row */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1207
	resize_fdisk_table(1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1208
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1209
	/* Relocate static widgets */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1210
	relocate_static_widgets(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1211
	    MainWindow.InstallationDiskWindow.fdisktablerows);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1212
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1213
	/* Push all other partitions down one row in table */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1214
	relocate_partition_widgets(pidx, 1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1215
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1216
	if (appendatend == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1217
		top_attach =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1218
		    MainWindow.InstallationDiskWindow.partrow[pidx] +
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1219
		    MainWindow.InstallationDiskWindow.numpartlogical[pidx];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1220
		bottom_attach =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1221
		    MainWindow.InstallationDiskWindow.partrow[pidx] +
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1222
		    MainWindow.InstallationDiskWindow.numpartlogical[pidx] + 1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1223
	} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1224
		/* Relocate all widgets down one that exist after lidx */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1225
		relocate_extended_widgets(pidx, (lidx-FD_NUMPART), 1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1226
		/* Top attach = primaryrow + (startlogical+1) + 1 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1227
		top_attach = MainWindow.InstallationDiskWindow.partrow[pidx] +
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1228
		    (lidx - FD_NUMPART + 1) + 1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1229
		bottom_attach = top_attach + 1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1230
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1231
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1232
	newlogicalpart = g_new0(LogicalPartition, 1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1233
	newlogicalpart->next = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1234
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1235
	/* Add new LogicalPartition element to linked list */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1236
	if (MainWindow.InstallationDiskWindow.startlogical[pidx] == NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1237
		/* Create first logical partition */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1238
		MainWindow.InstallationDiskWindow.startlogical[pidx] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1239
		    newlogicalpart;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1240
	} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1241
		/* Create next one in line */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1242
		if (appendatend == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1243
			logicalpart_append(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1244
			    MainWindow.InstallationDiskWindow.startlogical[pidx],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1245
			    newlogicalpart);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1246
		} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1247
			if (lidx == -1) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1248
				/* Insert at start of list */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1249
				newlogicalpart->next =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1250
				    MainWindow.InstallationDiskWindow.startlogical[pidx];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1251
				MainWindow.InstallationDiskWindow.startlogical[pidx] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1252
				    newlogicalpart;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1253
				lidx = FD_NUMPART;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1254
			} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1255
				/* insert after lidx item */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1256
				logicalpart_insert_after(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1257
				    MainWindow.InstallationDiskWindow.startlogical[pidx],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1258
				    lidx, newlogicalpart);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1259
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1260
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1261
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1262
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1263
	/* Create the new indented logical partition */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1264
	logical_partition_init(pidx, newlogicalpart, top_attach, bottom_attach);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1265
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1266
	return (newlogicalpart);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1267
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1268
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1269
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1270
primary_update_avail_space(disk_parts_t *partitions)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1271
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1272
	partition_info_t *partinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1273
	gint pidx = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1274
	GtkLabel *availlabel = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1275
	GtkSpinButton *spinner = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1276
	gint parttype;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1277
	gfloat avail_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1278
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1279
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1280
	 * Cycle through each defined primary partition, and update the
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1281
	 * Avail space column based the rest of the items
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1282
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1283
	for (pidx = 0; pidx < FD_NUMPART; pidx++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1284
		partinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1285
		    orchestrator_om_get_part_by_blkorder(partitions, pidx);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1286
		g_assert(partinfo != NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1287
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1288
		spinner = GTK_SPIN_BUTTON
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1289
		    (MainWindow.InstallationDiskWindow.partspin[pidx]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1290
		availlabel = GTK_LABEL
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1291
		    (MainWindow.InstallationDiskWindow.partavail[pidx]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1292
		parttype = orchestrator_om_get_partition_type(partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1293
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1294
		avail_size = calculate_avail_space(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1295
		    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1296
		    -1, partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1297
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1298
		if (IS_EXT_PAR(parttype)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1299
			/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1300
			 * For extended partitions the lowest value we can
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1301
			 * spin down to is the lowest size of it's containing
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1302
			 * logicals minus any unused space at the end.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1303
			 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1304
			set_range_avail_from_value(spinner, availlabel,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1305
			    get_extended_partition_min_size(partitions),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1306
			    avail_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1307
		} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1308
			set_range_avail_from_value(spinner, availlabel,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1309
			    parttype == UNUSED ? 0 : 0.1,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1310
			    avail_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1311
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1312
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1313
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1314
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1315
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1316
logical_update_avail_space(disk_parts_t *partitions)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1317
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1318
	partition_info_t *partinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1319
	partition_info_t *primpartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1320
	gint pidx = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1321
	gint lidx = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1322
	GtkLabel *availlabel = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1323
	GtkSpinButton *spinner = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1324
	gint parttype;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1325
	LogicalPartition *logicalpart;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1326
	gfloat avail_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1327
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1328
	/* Get primary extended startlogical */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1329
	for (pidx = 0; pidx < FD_NUMPART; pidx++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1330
		if (MainWindow.InstallationDiskWindow.startlogical[pidx] != NULL)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1331
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1332
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1333
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1334
	if (pidx == FD_NUMPART) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1335
		g_warning("Logical partition starting element not found\n");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1336
		return;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1337
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1338
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1339
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1340
	 * Cycle through each defined primary partition, find the appropriate
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1341
	 * Extended partition, and for each of it's logical children update
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1342
	 * their avail space
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1343
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1344
	for (lidx = FD_NUMPART; lidx < OM_NUMPART; lidx++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1345
		partinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1346
		    orchestrator_om_get_part_by_blkorder(partitions, lidx);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1347
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1348
		if (partinfo) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1349
			parttype = orchestrator_om_get_partition_type(partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1350
			logicalpart = get_logical_partition_at_pos(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1351
			    (lidx+1)-FD_NUMPART,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1352
			    MainWindow.InstallationDiskWindow.startlogical[pidx]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1353
			spinner = GTK_SPIN_BUTTON(logicalpart->sizespinner);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1354
			availlabel = GTK_LABEL(logicalpart->availlabel);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1355
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1356
			/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1357
			 * Get free space either side of this logical partition
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1358
			 * For logical partitions this is only pertinent for
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1359
			 * Solaris partitions
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1360
			 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1361
			avail_size = calculate_avail_space(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1362
			    modifiedlogicalblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1363
			    -1, partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1364
			set_range_avail_from_value(spinner, availlabel,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1365
			    parttype == UNUSED ? 0 : 0.1,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1366
			    avail_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1367
		} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1368
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1369
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1370
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1371
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1372
	/* We need to set the spinner range for the parent extended partition */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1373
	primpartinfo = orchestrator_om_get_part_by_blkorder(partitions, pidx);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1374
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1375
	if (primpartinfo != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1376
		gtk_spin_button_set_range(GTK_SPIN_BUTTON(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1377
		    MainWindow.InstallationDiskWindow.partspin[pidx]),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1378
		    get_extended_partition_min_size(partitions),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1379
		    ONE_DECIMAL(calculate_avail_space(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1380
		    modifiedprimaryblkorder[activedisk], -1, primpartinfo)));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1381
	} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1382
		g_warning(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1383
		    "logical_update_avail_space() : Failed to get extended %d",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1384
		    pidx);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1385
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1386
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1387
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1388
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1389
logical_partition_combo_changed(GtkWidget *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1390
	gpointer user_data)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1391
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1392
#if defined(__i386)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1393
	LogicalPartition *logicalpart = (LogicalPartition *)user_data;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1394
	GtkSpinButton *spinner = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1395
	GtkComboBox *combo = GTK_COMBO_BOX(widget);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1396
	GtkLabel *avail = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1397
	gpointer objectdata = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1398
	int index;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1399
	gchar *errorprimarytext = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1400
	gchar *errorsecondarytext = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1401
	guint i = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1402
	partition_info_t *partinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1403
	partition_info_t *logpartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1404
	disk_parts_t *partitions;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1405
	gfloat avail_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1406
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1407
	/* Block all other handlers why we set a few things */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1408
	disk_partitioning_block_all_handlers();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1409
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1410
	spinner = GTK_SPIN_BUTTON(logicalpart->sizespinner);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1411
	avail = GTK_LABEL(logicalpart->availlabel);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1412
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1413
	partitions = modifiedpartitions[activedisk];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1414
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1415
	/* Get partition_info_t for this logical partition */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1416
	partinfo = orchestrator_om_get_part_by_blkorder(partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1417
	    logicalpart->logpartindex);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1418
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1419
	index = gtk_combo_box_get_active(combo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1420
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1421
	if (index == UNUSED_PARTITION) { /* Denotes Unused partition */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1422
		gtk_spin_button_set_range(spinner, 0, 0);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1423
		gtk_widget_set_sensitive(GTK_WIDGET(spinner), FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1424
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1425
		/* Avail size should be set to just this partitions size */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1426
		set_size_widgets_from_value(spinner, avail,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1427
		    orchestrator_om_round_mbtogb(partinfo->partition_size));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1428
	} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1429
		/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1430
		 * If Changing from Unused we need re-calculate the AVAIL space
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1431
		 * And set spin button ranges and value
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1432
		 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1433
		if (logicalpart->partcombosaved == UNUSED) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1434
			avail_size = calculate_avail_space(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1435
			    modifiedlogicalblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1436
			    logicalpart->logpartindex, partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1437
			set_range_avail_from_value(spinner, avail, 0.1, avail_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1438
			set_size_widgets_from_value(spinner, NULL,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1439
			    orchestrator_om_get_partition_sizegb(partinfo));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1440
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1441
		gtk_widget_set_sensitive(GTK_WIDGET(spinner), TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1442
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1443
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1444
	logicalpart->partcombosaved = index;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1445
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1446
	if (activediskisreadable == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1447
		logicalpart->typechange = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1448
		logicalpart->sizechange = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1449
		update_data_loss_warnings();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1450
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1451
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1452
	update_disk_partitions_from_ui(partitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1453
	logical_update_avail_space(partitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1454
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1455
	g_object_set_data(G_OBJECT(diskbuttons[activedisk]),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1456
	    "modified",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1457
	    GINT_TO_POINTER(TRUE));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1458
	gtk_widget_set_sensitive(GTK_WIDGET(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1459
	    MainWindow.InstallationDiskWindow.resetbutton),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1460
	    TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1461
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1462
	/* Unblock all the handlers */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1463
	disk_partitioning_unblock_all_handlers();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1464
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1465
	g_debug("Logical Partition Combo Changed");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1466
	print_partinfos(activedisk, alldiskinfo, modifiedpartitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1467
	print_blkorder(alldiskinfo[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1468
	    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1469
	    modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1470
	print_gui(MainWindow.InstallationDiskWindow);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1471
#endif
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1472
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1473
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1474
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1475
primary_update_combo_sensitivity(disk_parts_t *partitions)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1476
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1477
	partition_info_t *partinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1478
	gint parttype = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1479
	gint pidx = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1480
	GtkSpinButton *primspinner = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1481
	GtkComboBox *primcombo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1482
	GtkLabel *primavail = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1483
	gfloat spinval = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1484
	gdouble avail_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1485
	gint comboidx = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1486
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1487
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1488
	 * Scan through all 4 primary partitions
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1489
	 * If this partition is unused and there is no available
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1490
	 * space, don't allow the user to change the partition type.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1491
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1492
	for (pidx = 0; pidx < FD_NUMPART; pidx++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1493
		primcombo = GTK_COMBO_BOX
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1494
		    (MainWindow.InstallationDiskWindow.partcombo[pidx]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1495
		primspinner = GTK_SPIN_BUTTON
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1496
		    (MainWindow.InstallationDiskWindow.partspin[pidx]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1497
		primavail = GTK_LABEL
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1498
		    (MainWindow.InstallationDiskWindow.partavail[pidx]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1499
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1500
		spinval = (gfloat)gtk_spin_button_get_value(primspinner);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1501
		avail_size = strtod(gtk_label_get_text(primavail), NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1502
		comboidx = gtk_combo_box_get_active(primcombo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1503
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1504
		if (comboidx == UNUSED_PARTITION) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1505
			if (avail_size > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1506
				gtk_widget_set_sensitive(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1507
				    GTK_WIDGET(primcombo), TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1508
			} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1509
				gtk_widget_set_sensitive(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1510
				    GTK_WIDGET(primcombo), FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1511
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1512
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1513
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1514
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1515
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1516
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1517
primary_partition_combo_changed(GtkWidget *widget,
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1518
    gint partindex,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1519
    gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1520
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1521
#if defined(__i386)
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1522
	GtkSpinButton *spinner = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1523
	GtkComboBox *combo = GTK_COMBO_BOX(widget);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1524
	GtkLabel *avail = NULL;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1525
	gpointer objectdata = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1526
	int index;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1527
	gchar *errorprimarytext = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1528
	gchar *errorsecondarytext = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1529
	guint i = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1530
	LogicalPartition *logicalpart = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1531
	partition_info_t *partinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1532
	partition_info_t *logpartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1533
	disk_parts_t *partitions;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1534
	gfloat partsize = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1535
	gfloat avail_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1536
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1537
	/* Block all other handlers why we set a few things */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1538
	disk_partitioning_block_all_handlers();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1539
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1540
	spinner = GTK_SPIN_BUTTON(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1541
	    MainWindow.InstallationDiskWindow.partspin[partindex]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1542
	avail = GTK_LABEL(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1543
	    MainWindow.InstallationDiskWindow.partavail[partindex]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1544
	partitions = modifiedpartitions[activedisk];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1545
	partinfo = orchestrator_om_get_part_by_blkorder(partitions, partindex);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1546
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1547
	index = gtk_combo_box_get_active(combo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1548
	if (index == UNUSED_PARTITION) { /* Denotes Unused partition */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1549
		/* If previous logicals exist, remove and collapse down */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1550
		if (MainWindow.InstallationDiskWindow.startlogical[partindex]
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1551
		    != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1552
			logical_partitions_remove_all_ui(partindex);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1553
			logical_partitions_remove_all(partindex);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1554
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1555
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1556
		gtk_spin_button_set_range(spinner, 0, 0);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1557
		gtk_widget_set_sensitive(GTK_WIDGET(spinner), FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1558
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1559
		/* Avail size should be set to just this partitions size */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1560
		avail_size = calculate_avail_space(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1561
		    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1562
		    partindex, partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1563
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1564
		set_size_widgets_from_value(spinner, avail, avail_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1565
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1566
		/* Partition size gets nuked so set the flag */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1567
		if (activediskisreadable)
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1568
			MainWindow.InstallationDiskWindow.partsizechanges[partindex]
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1569
			    = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1570
	} else if (index == EXTENDED_PARTITION) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1571
		/* Determine if extended partition already exists */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1572
		for (i = 0; i < FD_NUMPART; i++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1573
			if (MainWindow.InstallationDiskWindow.startlogical[i]
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1574
			    != NULL &&
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1575
			    i != partindex) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1576
				/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1577
				 * Extended partition already defined, can only
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1578
				 * have one Warn user that they need to change
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1579
				 * other one first.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1580
				 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1581
				errorprimarytext =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1582
				    g_strdup(_("Only one extended partition can exist."));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1583
				errorsecondarytext =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1584
				    g_strdup(_("Choose another type."));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1585
				gui_install_prompt_dialog(FALSE, FALSE, FALSE,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1586
				    GTK_MESSAGE_ERROR,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1587
				    errorprimarytext,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1588
				    errorsecondarytext);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1589
				g_free(errorprimarytext);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1590
				g_free(errorsecondarytext);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1591
				revert_partcombo_value(partindex);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1592
				disk_partitioning_unblock_all_handlers();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1593
				return;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1594
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1595
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1596
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1597
		/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1598
		 * If Changing from Unused we need re-calculate the AVAIL space
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1599
		 * And set spin button ranges and value
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1600
		 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1601
		if (MainWindow.InstallationDiskWindow.partcombosaved[partindex] ==
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1602
		    UNUSED) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1603
			partsize =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1604
			    orchestrator_om_get_partition_sizegb(partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1605
			if (partsize == 0.0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1606
				/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1607
				 * This partition is going to be assigned 0.1 in
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1608
				 * size so we need to remove 0.1 from the first
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1609
				 * unused item either below or above this item.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1610
				 * There will always be unused space somewhere
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1611
				 * at this point otherwise the combobox would
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1612
				 * not have been active.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1613
				 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1614
				update_primary_unused_partition_size_from_ui(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1615
				    partitions, partindex, 0.1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1616
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1617
			avail_size = calculate_avail_space(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1618
			    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1619
			    partindex, partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1620
			set_range_avail_from_value(spinner, avail, 0.1, avail_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1621
			set_size_widgets_from_value(spinner, NULL,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1622
			    orchestrator_om_get_partition_sizegb(partinfo));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1623
		} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1624
			set_size_widgets_from_value(spinner, NULL,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1625
			    orchestrator_om_get_partition_sizegb(partinfo));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1626
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1627
		gtk_widget_set_sensitive(GTK_WIDGET(spinner), TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1628
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1629
		if (MainWindow.InstallationDiskWindow.startlogical[partindex]
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1630
		    == NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1631
			/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1632
			 * Physically create first logical partition within
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1633
			 * modifiedpartitions and modifiedlogicalblkorder
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1634
			 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1635
			logpartinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1636
			    create_logical_partition(FD_NUMPART, FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1637
			logpartinfo->partition_size =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1638
			    partinfo->partition_size;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1639
			logpartinfo->partition_offset =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1640
			    partinfo->partition_offset;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1641
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1642
			update_blkorder_from_partinfo(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1643
			    modifiedlogicalblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1644
			    logpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1645
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1646
			/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1647
			 * This should never happen, as there should be
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1648
			 * no logicals in Existence at this point, this
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1649
			 * should be the only one !!
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1650
			 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1651
			g_assert(logpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1652
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1653
			/* Create new logical partition */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1654
			logicalpart = create_logical_partition_ui(partindex,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1655
			    FD_NUMPART, TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1656
			logicalpart->logpartindex = FD_NUMPART;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1657
			set_size_widgets_from_value(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1658
			    GTK_SPIN_BUTTON(logicalpart->sizespinner),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1659
			    GTK_LABEL(logicalpart->availlabel),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1660
			    orchestrator_om_get_partition_sizegb(partinfo));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1661
			logicalpart->typechange = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1662
			logicalpart->partcombosaved = UNUSED_PARTITION;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1663
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1664
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1665
		/* Partition will get nuked so set the flag */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1666
		if (activediskisreadable)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1667
			MainWindow.InstallationDiskWindow.partsizechanges[partindex]
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1668
			    = TRUE;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1669
	} else {
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1670
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1671
		/* If previous logicals exist, remove and collapse down */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1672
		if (MainWindow.InstallationDiskWindow.startlogical[partindex]
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1673
		    != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1674
			logical_partitions_remove_all_ui(partindex);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1675
			logical_partitions_remove_all(partindex);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1676
		}
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1677
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1678
		/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1679
		 * If Changing from Unused we need re-calculate the AVAIL space
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1680
		 * And set spin button ranges and value
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1681
		 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1682
		if (MainWindow.InstallationDiskWindow.partcombosaved[partindex] ==
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1683
		    UNUSED) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1684
			partsize =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1685
			    orchestrator_om_get_partition_sizegb(partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1686
			if (partsize == 0.0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1687
				/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1688
				 * This partition is going to be assigned 0.1
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1689
				 * in size so we need to remove 0.1 from the
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1690
				 * first unused item either below or above
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1691
				 * this item. There will always be unused
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1692
				 * space somewhere at this point otherwise
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1693
				 * the combobox would not have been active.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1694
				 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1695
				update_primary_unused_partition_size_from_ui(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1696
				    partitions, partindex, 0.1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1697
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1698
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1699
			avail_size = calculate_avail_space(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1700
			    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1701
			    partindex, partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1702
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1703
			set_range_avail_from_value(spinner, avail, 0.1, avail_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1704
			set_size_widgets_from_value(spinner, NULL,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1705
			    orchestrator_om_get_partition_sizegb(partinfo));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1706
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1707
		gtk_widget_set_sensitive(GTK_WIDGET(spinner), TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1708
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1709
		/* Partition size also changes from 0 to 1gb so set the flag */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1710
		if (activediskisreadable)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1711
			MainWindow.InstallationDiskWindow.partsizechanges[partindex]
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1712
			    = TRUE;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1713
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1714
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1715
	MainWindow.InstallationDiskWindow.partcombosaved[partindex] = index;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1716
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1717
	objectdata = g_object_get_data(G_OBJECT(combo), "extra_fs");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1718
	if ((objectdata != NULL) && (GPOINTER_TO_INT(objectdata) == TRUE)) {
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1719
		gtk_combo_box_remove_text(combo,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1720
		    NUM_DEFAULT_PARTITIONS);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1721
		g_object_set_data(G_OBJECT(combo),
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1722
		    "extra_fs",
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1723
		    GINT_TO_POINTER(FALSE));
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1724
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1725
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1726
	if (activediskisreadable == TRUE) {
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1727
		MainWindow.InstallationDiskWindow.parttypechanges[partindex]
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1728
		    = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1729
		MainWindow.InstallationDiskWindow.initialsizechange[partindex]
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1730
		    = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1731
		update_data_loss_warnings();
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1732
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1733
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1734
	update_disk_partitions_from_ui(partitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1735
	primary_update_avail_space(partitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1736
	primary_update_combo_sensitivity(partitions);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1737
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1738
	g_object_set_data(G_OBJECT(diskbuttons[activedisk]),
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1739
	    "modified",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1740
	    GINT_TO_POINTER(TRUE));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1741
	gtk_widget_set_sensitive(GTK_WIDGET(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1742
	    MainWindow.InstallationDiskWindow.resetbutton),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1743
	    TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1744
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1745
	/* Unblock all the handlers, including any new logicals created */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1746
	disk_partitioning_unblock_all_handlers();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1747
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1748
	g_debug("Primary Partition Combo Changed");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1749
	print_partinfos(activedisk, alldiskinfo, modifiedpartitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1750
	print_blkorder(alldiskinfo[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1751
	    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1752
	    modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1753
	print_gui(MainWindow.InstallationDiskWindow);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1754
#endif
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1755
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1756
233
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  1757
static gboolean
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  1758
disk_is_too_big(disk_info_t *diskinfo)
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  1759
{
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  1760
	return orchestrator_om_get_total_disk_sizemb(diskinfo) >
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  1761
	    orchestrator_om_get_disk_sizemb(diskinfo) ? TRUE : FALSE;
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  1762
}
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  1763
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1764
void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1765
partition_0_combo_changed(GtkWidget *widget, gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1766
{
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1767
	primary_partition_combo_changed(widget, 0, user_data);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1768
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1769
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1770
void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1771
partition_1_combo_changed(GtkWidget *widget, gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1772
{
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1773
	primary_partition_combo_changed(widget, 1, user_data);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1774
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1775
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1776
void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1777
partition_2_combo_changed(GtkWidget *widget, gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1778
{
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1779
	primary_partition_combo_changed(widget, 2, user_data);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1780
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1781
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1782
void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1783
partition_3_combo_changed(GtkWidget *widget, gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  1784
{
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1785
	primary_partition_combo_changed(widget, 3, user_data);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1786
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1787
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1788
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1789
turn_on_partsizechanges(guint index)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1790
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1791
	if (activediskisreadable == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1792
		MainWindow.InstallationDiskWindow.partsizechanges[index] = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1793
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1794
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1795
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1796
update_extended_partition(disk_parts_t *partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1797
	gint pidx,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1798
	gfloat diffgb)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1799
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1800
	partition_info_t *modpartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1801
	partition_info_t *logpartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1802
	LogicalPartition *logicalpart = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1803
	gint parttype = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1804
	DiskBlockOrder *curblkorder = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1805
	guint lidx = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1806
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1807
	/* if changing the size of an extended partition, then all it's */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1808
	/* existing partitions are essentially being destroyed, so collapse */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1809
	/* any logicals, reseting the modifiedlogicalblkorder list aswell */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1810
	/* If an extended partitions size has already been modified, then add */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1811
	/* Free space to unused item at end list of logicals, creating one if */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1812
	/* necessary */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1813
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1814
	modpartinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1815
	    orchestrator_om_get_part_by_blkorder(partitions, pidx);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1816
	g_assert(modpartinfo != NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1817
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1818
	parttype = orchestrator_om_get_partition_type(modpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1819
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1820
	/* Only interested if this partition is an extended partition */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1821
	if (IS_EXT_PAR(parttype)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1822
		if (MainWindow.InstallationDiskWindow.initialsizechange[pidx]
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1823
		    == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1824
			/* Regardless of whether size increased or decreased */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1825
			/* First time resetting size */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1826
			MainWindow.InstallationDiskWindow.initialsizechange[pidx]
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1827
			    = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1828
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1829
			/* Collapse all existing logicals and destroy widgets */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1830
			logical_partitions_remove_all_ui(pidx);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1831
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1832
			/* Clean out modifiedlogicalblkorder */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1833
			/* Reset all partitions[FD_NUMPART+] */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1834
			logical_partitions_remove_all(pidx);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1835
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1836
			/* Add one new logical back to modifiedpartitions and */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1837
			/* to modifiedlogicalblkorder aswell */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1838
			logpartinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1839
			    create_logical_partition(FD_NUMPART, FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1840
			logpartinfo->partition_size =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1841
			    modpartinfo->partition_size;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1842
			logpartinfo->partition_offset =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1843
			    modpartinfo->partition_offset;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1844
			update_blkorder_from_partinfo(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1845
			    modifiedlogicalblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1846
			    logpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1847
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1848
			/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1849
			 * This should never happen, as there should be
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1850
			 * no logicals in Existence at this point, this
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1851
			 * should be the only one !!
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1852
			 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1853
			g_assert(logpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1854
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1855
			/* Create one unused logical partition ui component */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1856
			logicalpart = create_logical_partition_ui(pidx,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1857
			    FD_NUMPART, TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1858
			logicalpart->logpartindex = FD_NUMPART;
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  1859
			logicalpart->sizechange = TRUE;
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  1860
			logicalpart->typechange = TRUE;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1861
			set_size_widgets_from_value(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1862
			    GTK_SPIN_BUTTON(logicalpart->sizespinner),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1863
			    GTK_LABEL(logicalpart->availlabel),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1864
			    orchestrator_om_get_partition_sizegb(logpartinfo));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1865
			logicalpart->typechange = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1866
			logicalpart->partcombosaved = UNUSED_PARTITION;
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  1867
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  1868
			update_data_loss_warnings();
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1869
		} else if (diffgb != 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1870
			/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1871
			 * Size has changed before, so any logicals
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1872
			 * currently defined are newly defined user ones,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1873
			 * simply add new unused space to end of logicals
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1874
			 * Or remove from unused space currently there If
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1875
			 * no unused space left.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1876
			 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1877
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1878
			if (diffgb > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1879
				/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1880
				 * Primary Extended increased in size, so
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1881
				 * add this difference To Last unused item
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1882
				 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1883
				curblkorder = installationdisk_blkorder_getlast(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1884
				    modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1885
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1886
				parttype = orchestrator_om_get_partition_type(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1887
				    &curblkorder->partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1888
				if (parttype == UNUSED) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1889
					curblkorder->partinfo.partition_size +=
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1890
					    orchestrator_om_gbtomb(diffgb);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1891
					if (update_partinfo_from_blkorder(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1892
					    FALSE, curblkorder,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1893
					    partitions) == FALSE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1894
						g_warning("Failed updating last unused logical " \
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1895
						    "partinfo from blkorder after extended changed " \
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1896
						    "in size by : %f, blkorder partition_id is %d",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1897
						    orchestrator_om_gbtomb(diffgb),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1898
						    curblkorder->partinfo.partition_id);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1899
						print_partinfos(activedisk,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1900
						    alldiskinfo, modifiedpartitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1901
						print_blkorder(alldiskinfo[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1902
						    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1903
						    modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1904
					}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1905
				} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1906
					/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1907
					 * Last item is not unused, so we need
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1908
					 * to add a new one And display it as
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1909
					 * unused
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1910
					 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1911
					logpartinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1912
					    create_logical_partition(-1, FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1913
					logpartinfo->partition_size =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1914
					    orchestrator_om_gbtomb(diffgb);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1915
					update_blkorder_from_partinfo(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1916
					    modifiedlogicalblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1917
					    logpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1918
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1919
					/* Create new logical widgets */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1920
					logicalpart =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1921
					    create_logical_partition_ui(pidx,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1922
					    logpartinfo->partition_order-1,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1923
					    TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1924
					logicalpart->logpartindex =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1925
					    logpartinfo->partition_order-1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1926
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1927
					set_size_widgets_from_value(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1928
					    GTK_SPIN_BUTTON(logicalpart->sizespinner),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1929
					    GTK_LABEL(logicalpart->availlabel),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1930
					    orchestrator_om_get_partition_sizegb(logpartinfo));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1931
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1932
					logicalpart->typechange = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1933
					logicalpart->partcombosaved =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1934
					    UNUSED_PARTITION;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1935
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1936
			} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1937
				/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1938
				 * diffgb < 0, therefore Primary Extended
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1939
				 * partition has been decreased in size.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1940
				 * We need to reduce one or more of it's
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1941
				 * logical partitions. Starting at the
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1942
				 * last partition, starting reducing sizes.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1943
				 * If last logical partition does not
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1944
				 * contain enough to be reduced, then it
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1945
				 * is dropped completely, and the next
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1946
				 * partition up is reduced by the remainder
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1947
				 * amount. This sequence continues until
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1948
				 * all space has been reduced.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1949
				 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1950
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1951
				curblkorder = installationdisk_blkorder_getlast(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1952
				    modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1953
				for (; curblkorder != NULL; ) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1954
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1955
					if (diffgb == 0)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1956
						break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1957
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1958
					parttype =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1959
					    orchestrator_om_get_partition_type(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1960
					    &curblkorder->partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1961
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1962
					/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1963
					 * Regardless of partition type we must
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1964
					 * reduce it's size. As partition is
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1965
					 * reduced from the bottom up.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1966
					 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1967
					if ((orchestrator_om_gbtomb(diffgb)*-1) <=
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1968
					    curblkorder->partinfo.partition_size) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1969
						/* Just need to reduce this single partitions size */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1970
						curblkorder->partinfo.partition_size +=
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1971
						    orchestrator_om_gbtomb(diffgb);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1972
						if (orchestrator_om_round_mbtogb(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1973
						    curblkorder->partinfo.partition_size) == 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1974
							curblkorder->partinfo.partition_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1975
						}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1976
						diffgb = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1977
					} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1978
						diffgb = diffgb + orchestrator_om_round_mbtogb(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1979
						    curblkorder->partinfo.partition_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1980
						curblkorder->partinfo.partition_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1981
					}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1982
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1983
					/* Update equivalent item in modifiedpartitions array */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1984
					if (update_partinfo_from_blkorder(FALSE, curblkorder,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1985
					    partitions) == FALSE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1986
						g_warning("Failed updating logical partinfo " \
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1987
						    "from blkorder after extended changed " \
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1988
						    "in size by : %f, blkorder partition_id is %d",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1989
						    orchestrator_om_gbtomb(diffgb),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1990
						    curblkorder->partinfo.partition_id);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1991
						print_partinfos(activedisk,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1992
						    alldiskinfo, modifiedpartitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1993
						print_blkorder(alldiskinfo[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1994
						    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1995
						    modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1996
					}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1997
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1998
					/* If partition_Size is now zero, remove from lists */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  1999
					if (curblkorder->partinfo.partition_size == 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2000
						/* Get linked list item number */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2001
						lidx = installationdisk_blkorder_get_index(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2002
						    modifiedlogicalblkorder[activedisk], curblkorder);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2003
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2004
						/* Remove this widget from display */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2005
						logical_partition_remove_ui(partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2006
						    &curblkorder->partinfo, pidx, lidx);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2007
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2008
						/* Remove from partitions */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2009
						curblkorder = logical_partition_remove(partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2010
						    curblkorder, FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2011
						continue;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2012
					}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2013
					curblkorder = installationdisk_blkorder_getprev(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2014
					    modifiedlogicalblkorder[activedisk], curblkorder);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2015
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2016
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2017
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2018
		/* redisplay avail space for all logicals */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2019
		logical_update_avail_space(partitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2020
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2021
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2022
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2023
static gint
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2024
get_primary_extended_index(disk_parts_t *partitions)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2025
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2026
	partition_info_t *partinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2027
	gint parttype = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2028
	gint pidx = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2029
	gint retpidx = -1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2030
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2031
	for (pidx = 0; pidx < FD_NUMPART; pidx++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2032
		partinfo = orchestrator_om_get_part_by_blkorder(partitions, pidx);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2033
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2034
		if (partinfo) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2035
			parttype =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2036
			    orchestrator_om_get_partition_type(partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2037
			if (IS_EXT_PAR(parttype)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2038
				retpidx = pidx;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2039
				break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2040
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2041
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2042
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2043
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2044
	return (retpidx);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2045
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2046
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2047
static void
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2048
update_logical_unused_partition_size_from_ui(disk_parts_t *partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2049
	LogicalPartition *logicalpart,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2050
	gfloat diffgb)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2051
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2052
	partition_info_t *modpartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2053
	partition_info_t *logpartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2054
	gint parttype;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2055
	gboolean moditem_found = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2056
	DiskBlockOrder *curblkorder = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2057
	LogicalPartition *newlogicalpart = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2058
	gint lidx = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2059
	gint pidx = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2060
	gfloat avail_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2061
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2062
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2063
	 * Size spinner has either increased or decreased
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2064
	 * If eating into availspace from either below or above
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2065
	 * Need to reduce/increase the partition_size of appropriate elements
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2066
	 * above and below, doing this will allow for calculation of available
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2067
	 * space for other widgets.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2068
	 * Only spinners of type Solaris or Extended can change their spinner.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2069
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2070
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2071
	modpartinfo = orchestrator_om_get_part_by_blkorder(partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2072
	    logicalpart->logpartindex);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2073
	g_assert(modpartinfo != NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2074
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2075
	/* Get primary index of extended partition */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2076
	pidx = get_primary_extended_index(partitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2077
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2078
	g_return_if_fail(diffgb != 0);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2079
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2080
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2081
	 * Scan for unused items after changed partition, and reduce it's
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2082
	 * size first, if cannot reduce any more, then need to scan again
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2083
	 * for items above this that are unused and reduce them by left over
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2084
	 * amount
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2085
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2086
	/* First scan is for unused items after current modified item */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2087
	moditem_found = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2088
	for (curblkorder = modifiedlogicalblkorder[activedisk];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2089
	    curblkorder != NULL; TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2090
		if (curblkorder->partinfo.partition_id == modpartinfo->partition_id) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2091
			moditem_found = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2092
		} else if (moditem_found == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2093
			parttype =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2094
			    orchestrator_om_get_partition_type(&curblkorder->partinfo);
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  2095
			if (parttype == UNUSED &&
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2096
			    ((curblkorder->partinfo.partition_size > 0 && diffgb > 0) ||
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2097
			    (diffgb < 0))) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2098
				/* We have an unused block of disc */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2099
				if (diffgb > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2100
					if (orchestrator_om_gbtomb(diffgb) <=
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2101
					    curblkorder->partinfo.partition_size) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2102
						curblkorder->partinfo.partition_size -=
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2103
						    orchestrator_om_gbtomb(diffgb);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2104
						diffgb = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2105
						if (orchestrator_om_round_mbtogb(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2106
						    curblkorder->partinfo.partition_size) == 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2107
							curblkorder->partinfo.partition_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2108
						}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2109
					} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2110
						diffgb = diffgb - orchestrator_om_round_mbtogb(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2111
						    curblkorder->partinfo.partition_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2112
						curblkorder->partinfo.partition_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2113
					}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2114
				} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2115
					curblkorder->partinfo.partition_size -=
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2116
					    orchestrator_om_gbtomb(diffgb);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2117
					diffgb = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2118
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2119
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2120
				if (update_partinfo_from_blkorder(FALSE, curblkorder,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2121
				    partitions) == FALSE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2122
					g_warning("Failed updating logical partinfo " \
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2123
					    "after current from blkorder after extended changed " \
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2124
					    "in size by : %f, blkorder partition_id is %d",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2125
					    orchestrator_om_gbtomb(diffgb),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2126
					    curblkorder->partinfo.partition_id);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2127
					print_partinfos(activedisk,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2128
					    alldiskinfo, modifiedpartitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2129
					print_blkorder(alldiskinfo[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2130
					    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2131
					    modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2132
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2133
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2134
				/* Unused item and ZERO so remove from blkorder */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2135
				if (curblkorder->partinfo.partition_size == 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2136
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2137
					/* Get the linked list index number */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2138
					lidx = installationdisk_blkorder_get_index(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2139
					    modifiedlogicalblkorder[activedisk], curblkorder);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2140
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2141
					/* Remove this widget from display */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2142
					logical_partition_remove_ui(partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2143
					    &curblkorder->partinfo, pidx, lidx);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2144
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2145
					/* Remove from partitions & blkorder */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2146
					curblkorder = logical_partition_remove(partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2147
					    curblkorder, TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2148
					continue;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2149
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2150
			} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2151
				break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2152
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2153
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2154
			if (diffgb == 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2155
				break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2156
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2157
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2158
		curblkorder = curblkorder->next;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2159
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2160
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2161
	if (diffgb < 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2162
		/* Space has been removed from current logical, and there is no */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2163
		/* Unused just after it to add the unused space to, so we need to */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2164
		/* create a new unused item after the current one, to contain this */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2165
		/* unused space */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2166
		lidx = FD_NUMPART-1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2167
		for (curblkorder = modifiedlogicalblkorder[activedisk];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2168
		    curblkorder != NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2169
		    curblkorder = curblkorder->next) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2170
			lidx++;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2171
			if (curblkorder->partinfo.partition_id ==
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2172
			    modpartinfo->partition_id) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2173
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2174
				/* Create a new logical partition at this location */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2175
				logpartinfo = create_logical_partition(lidx, FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2176
				logpartinfo->partition_size =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2177
				    orchestrator_om_gbtomb(diffgb * -1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2178
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2179
				update_blkorder_from_partinfo(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2180
				    modifiedlogicalblkorder[activedisk], logpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2181
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2182
				/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2183
				 * This will only ever happen if we have consumed all 32
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2184
				 * logicals... possible but highly unusual
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2185
				 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2186
				g_assert(logpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2187
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2188
				/* Create new logical partition */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2189
				newlogicalpart = create_logical_partition_ui(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2190
				    pidx, lidx, FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2191
				newlogicalpart->logpartindex = lidx+1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2192
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2193
				set_size_widgets_from_value(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2194
				    GTK_SPIN_BUTTON(newlogicalpart->sizespinner),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2195
				    GTK_LABEL(newlogicalpart->availlabel),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2196
				    orchestrator_om_get_partition_sizegb(logpartinfo));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2197
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2198
				newlogicalpart->typechange = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2199
				newlogicalpart->partcombosaved = UNUSED_PARTITION;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2200
				diffgb = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2201
				break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2202
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2203
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2204
	} else if (diffgb > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2205
		/* No more free space avail after current item so must search */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2206
		/* Before current item and reduce first available unused item */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2207
		moditem_found = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2208
		curblkorder = installationdisk_blkorder_getlast(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2209
		    modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2210
		for (; curblkorder != NULL; ) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2211
			if (curblkorder->partinfo.partition_id ==
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2212
			    modpartinfo->partition_id) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2213
				moditem_found = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2214
			} else if (moditem_found == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2215
				parttype =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2216
				    orchestrator_om_get_partition_type(&curblkorder->partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2217
				if (parttype == UNUSED &&
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2218
				    (curblkorder->partinfo.partition_size > 0 && diffgb > 0)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2219
					if (diffgb > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2220
						if (orchestrator_om_gbtomb(diffgb) <=
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2221
						    curblkorder->partinfo.partition_size) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2222
							curblkorder->partinfo.partition_size -=
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2223
							    orchestrator_om_gbtomb(diffgb);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2224
							diffgb = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2225
							if (orchestrator_om_round_mbtogb(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2226
							    curblkorder->partinfo.partition_size) == 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2227
								curblkorder->partinfo.partition_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2228
							}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2229
						} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2230
							diffgb = diffgb - orchestrator_om_round_mbtogb(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2231
							    curblkorder->partinfo.partition_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2232
							curblkorder->partinfo.partition_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2233
						}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2234
					} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2235
						/* See prev section as to why just setting to 0 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2236
						curblkorder->partinfo.partition_size -=
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2237
						    orchestrator_om_gbtomb(diffgb);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2238
						diffgb = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2239
					}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2240
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2241
					if (update_partinfo_from_blkorder(FALSE, curblkorder,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2242
					    partitions) == FALSE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2243
						g_warning("Failed updating logical partinfo before " \
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2244
						    "current from blkorder after extended changed " \
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2245
						    "in size by : %f, blkorder partition_id is %d",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2246
						    orchestrator_om_gbtomb(diffgb),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2247
						    curblkorder->partinfo.partition_id);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2248
						print_partinfos(activedisk,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2249
						    alldiskinfo, modifiedpartitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2250
						print_blkorder(alldiskinfo[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2251
						    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2252
						    modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2253
					}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2254
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2255
					/* Unused item and ZERO so remove from blkorder */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2256
					/* and remove from display */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2257
					if (curblkorder->partinfo.partition_size == 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2258
						/* Get the linked list index number */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2259
						lidx = installationdisk_blkorder_get_index(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2260
						    modifiedlogicalblkorder[activedisk], curblkorder);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2261
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2262
						/* Remove this widget from display */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2263
						logical_partition_remove_ui(partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2264
						    &curblkorder->partinfo, pidx, lidx);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2265
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2266
						/* Remove from partitions & blkorder */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2267
						curblkorder = logical_partition_remove(partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2268
						    curblkorder, FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2269
						continue;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2270
					}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2271
				} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2272
					break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2273
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2274
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2275
				if (diffgb == 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2276
					break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2277
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2278
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2279
			curblkorder = installationdisk_blkorder_getprev(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2280
			    modifiedlogicalblkorder[activedisk], curblkorder);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2281
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2282
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2283
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2284
	if (diffgb != 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2285
		g_warning("Some unused space not reduced.\n");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2286
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2287
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2288
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2289
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2290
update_primary_unused_partition_size_from_ui(disk_parts_t *partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2291
	gint pidx,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2292
	gfloat diffgb)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2293
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2294
	partition_info_t *modpartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2295
	gint parttype;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2296
	gboolean moditem_found = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2297
	DiskBlockOrder *curblkorder = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2298
	DiskBlockOrder *modblkorder = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2299
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2300
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2301
	 * Size spinner has either increased or decreased
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2302
	 * If eating into availspace from either below or above
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2303
	 * Need to reduce/increase the partition_size of appropriate elements
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2304
	 * above and below, doing this will allow for calculation of available
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2305
	 * space for other widgets.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2306
	 * Only spinners of type Solaris or Extended can change their spinner.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2307
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2308
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2309
	modpartinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2310
	    orchestrator_om_get_part_by_blkorder(partitions, pidx);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2311
	g_assert(modpartinfo != NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2312
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2313
	g_return_if_fail(diffgb != 0);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2314
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2315
	print_partinfos(activedisk, alldiskinfo, modifiedpartitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2316
	print_blkorder(alldiskinfo[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2317
	    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2318
	    modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2319
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2320
	/* First verify that a blkorder item exists for this partition_id */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2321
	modblkorder = installationdisk_blkorder_get_by_partition_id(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2322
	    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2323
	    modpartinfo->partition_id);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2324
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2325
	if (modblkorder == NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2326
		/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2327
		 * We need to add a new blkorder item for this partition
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2328
		 * Question is where exactly.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2329
		 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2330
		/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2331
		 * Likely scenario in this case is where we've just
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2332
		 * made a unused primary solaris or extended.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2333
		 * And there is no primary partition matching this one
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2334
		 * located in the curblkorder layout.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2335
		 * We need to insert a new blkorder item to match newly
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2336
		 * displayed partinfo, we also need to reduce unused space
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2337
		 * from below first and then above both blkorder list
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2338
		 * and partinfo array.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2339
		 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2340
		/* Add a new item to curblklayout */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2341
		DiskBlockOrder *gap = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2342
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2343
		gap = g_new0(DiskBlockOrder, 1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2344
		gap->displayed = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2345
		gap->next = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2346
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2347
		orchestrator_om_set_partition_info(&gap->partinfo,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2348
		    orchestrator_om_gbtomb(diffgb), 0, 0, 0);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2349
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2350
		modpartinfo->partition_size = gap->partinfo.partition_size;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2351
		gap->partinfo.partition_id = modpartinfo->partition_id;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2352
		gap->partinfo.partition_order = modpartinfo->partition_order;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2353
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2354
		installationdisk_blkorder_insert_displayed(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2355
		    modifiedprimaryblkorder[activedisk], gap);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2356
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2357
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2358
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2359
	 * Scan for unused items after changed partition, and reduce it's
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2360
	 * size first, if cannot reduce any more, then need to scan again
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2361
	 * for items above this that are unused and reduce them by left over
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2362
	 * amount
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2363
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2364
	/* First scan is for unused items after current modified item */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2365
	moditem_found = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2366
	for (curblkorder = modifiedprimaryblkorder[activedisk];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2367
	    curblkorder != NULL; TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2368
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2369
		if (curblkorder->partinfo.partition_id == modpartinfo->partition_id) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2370
			moditem_found = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2371
		} else if (moditem_found == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2372
			parttype =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2373
			    orchestrator_om_get_partition_type(&curblkorder->partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2374
			/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2375
			 * If partition_size > 0 and diffgb > 0, means we
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2376
			 * are consuming used space, and there is some in
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2377
			 * this unused partition to consume from.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2378
			 * If diffgb < 0, we are returning some space to
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2379
			 * the unused pool, there fore we are not bothered
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2380
			 * what partition_size is, as we just add to it.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2381
			 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2382
			if (parttype == UNUSED &&
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2383
			    ((curblkorder->partinfo.partition_size > 0 && diffgb > 0) ||
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2384
			    (diffgb < 0))) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2385
				/* We have an unused block of disc */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2386
				if (diffgb > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2387
					if (orchestrator_om_gbtomb(diffgb) <=
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2388
					    curblkorder->partinfo.partition_size) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2389
						curblkorder->partinfo.partition_size -=
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2390
						    orchestrator_om_gbtomb(diffgb);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2391
						diffgb = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2392
						if (orchestrator_om_round_mbtogb(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2393
						    curblkorder->partinfo.partition_size) == 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2394
							curblkorder->partinfo.partition_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2395
						}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2396
					} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2397
						diffgb = diffgb - orchestrator_om_round_mbtogb(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2398
						    curblkorder->partinfo.partition_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2399
						curblkorder->partinfo.partition_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2400
					}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2401
				} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2402
					curblkorder->partinfo.partition_size -=
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2403
					    orchestrator_om_gbtomb(diffgb);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2404
					diffgb = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2405
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2406
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2407
				if (curblkorder->partinfo.partition_id != 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2408
					/* Item displayed is one of 4 primaries */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2409
					/* Update equivelent item in modifiedpartitions array */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2410
					if (update_partinfo_from_blkorder(TRUE, curblkorder,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2411
					    partitions) == FALSE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2412
						g_warning("Failed updating primary partinfo before " \
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2413
						    "current from blkorder after primary changed " \
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2414
						    "in size by : %f, blkorder partition_id is %d",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2415
						    orchestrator_om_gbtomb(diffgb),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2416
						    curblkorder->partinfo.partition_id);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2417
						print_partinfos(activedisk,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2418
						    alldiskinfo, modifiedpartitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2419
						print_blkorder(alldiskinfo[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2420
						    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2421
						    modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2422
					}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2423
				} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2424
					/* Unused item and not listed in primary, if size is */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2425
					/* ZERO remove from curblkorder as no longer valid */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2426
					if (curblkorder->partinfo.partition_size == 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2427
						curblkorder = installationdisk_blkorder_remove(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2428
						    TRUE,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2429
						    &modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2430
						    curblkorder, TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2431
						continue;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2432
					} else if (orchestrator_om_round_mbtogb(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2433
					    curblkorder->partinfo.partition_size) > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2434
						/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2435
						 * In this scenario, partition size is large
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2436
						 * enough to be displayed but is not currently
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2437
						 * Check if there is a non displayed primary
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2438
						 * where this gap could be displayed.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2439
						 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2440
						update_partinfo_from_blkorder_and_display(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2441
						    partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2442
						    modpartinfo,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2443
						    curblkorder);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2444
					}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2445
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2446
			} else if (parttype != UNUSED) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2447
				break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2448
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2449
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2450
			if (diffgb == 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2451
				break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2452
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2453
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2454
		curblkorder = curblkorder->next;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2455
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2456
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2457
	if (diffgb < 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2458
		/* Remove space from current partition, and there is no unused */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2459
		/* block to add this to, create one in the linked list just after */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2460
		/* The current item */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2461
		for (curblkorder = modifiedprimaryblkorder[activedisk];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2462
		    curblkorder != NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2463
		    curblkorder = curblkorder->next) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2464
			if (curblkorder->partinfo.partition_id ==
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2465
			    modpartinfo->partition_id) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2466
				/* Add a new item to curblklayout */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2467
				DiskBlockOrder *gap = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2468
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2469
				gap = g_new0(DiskBlockOrder, 1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2470
				gap->displayed = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2471
				gap->next = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2472
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2473
				orchestrator_om_set_partition_info(&gap->partinfo,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2474
				    orchestrator_om_gbtomb(diffgb*-1), 0, 0, 0);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2475
				installationdisk_blkorder_insert_after(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2476
				    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2477
				    curblkorder, gap, FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2478
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2479
				/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2480
				 * If we are adding a new piece of unsued space into the
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2481
				 * blkorder structure, check if all primary partition
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2482
				 * elements if partinfo[s] is assigned. If some are not
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2483
				 * assigned, possible then assign one with this free space
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2484
				 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2485
				installationdisk_blkorder_empty_partinfo_sync(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2486
				    modifiedpartitions[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2487
				    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2488
				    curblkorder, gap);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2489
				diffgb = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2490
				break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2491
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2492
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2493
	} else if (diffgb > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2494
		/* No more free space avail after current item so must search */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2495
		/* Before current item and reduce first available unused item */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2496
		moditem_found = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2497
		curblkorder = installationdisk_blkorder_getlast(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2498
		    modifiedprimaryblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2499
		print_partinfo(pidx, modpartinfo, TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2500
		for (; curblkorder != NULL; ) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2501
			print_partinfo(pidx, &curblkorder->partinfo, FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2502
			if (curblkorder->partinfo.partition_id ==
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2503
			    modpartinfo->partition_id) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2504
				moditem_found = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2505
			} else if (moditem_found == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2506
				parttype =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2507
				    orchestrator_om_get_partition_type(&curblkorder->partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2508
				if (parttype == UNUSED &&
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2509
				    (curblkorder->partinfo.partition_size > 0 && diffgb > 0)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2510
					if (diffgb > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2511
						if (orchestrator_om_gbtomb(diffgb) <=
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2512
						    curblkorder->partinfo.partition_size) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2513
							curblkorder->partinfo.partition_size -=
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2514
							    orchestrator_om_gbtomb(diffgb);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2515
							diffgb = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2516
							if (orchestrator_om_round_mbtogb(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2517
							    curblkorder->partinfo.partition_size) == 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2518
								curblkorder->partinfo.partition_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2519
							}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2520
						} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2521
							diffgb = diffgb - orchestrator_om_round_mbtogb(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2522
							    curblkorder->partinfo.partition_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2523
							curblkorder->partinfo.partition_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2524
						}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2525
					} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2526
						/* See prev section as to why just setting to 0 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2527
						curblkorder->partinfo.partition_size -=
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2528
						    orchestrator_om_gbtomb(diffgb);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2529
						diffgb = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2530
					}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2531
					if (curblkorder->partinfo.partition_id != 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2532
						/* Item displayed is one of 4 primaries */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2533
						/* Update equivelent item in modifiedpartitions array */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2534
						if (update_partinfo_from_blkorder(TRUE, curblkorder,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2535
						    partitions) == FALSE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2536
							g_warning("Failed updating primary partinfo " \
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2537
							    "after current from blkorder after primary " \
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2538
							    "changed in size by : %f, " \
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2539
							    "blkorder partition_id is %d",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2540
							    orchestrator_om_gbtomb(diffgb),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2541
							    curblkorder->partinfo.partition_id);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2542
							print_partinfos(activedisk,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2543
							    alldiskinfo, modifiedpartitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2544
							print_blkorder(alldiskinfo[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2545
							    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2546
							    modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2547
						}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2548
					} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2549
						/* Unused item and not listed in primary, if size is */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2550
						/* ZERO remove from curblkorder as no longer valid */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2551
						if (curblkorder->partinfo.partition_size == 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2552
							curblkorder = installationdisk_blkorder_remove(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2553
							    TRUE,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2554
							    &modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2555
							    curblkorder, FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2556
							continue;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2557
						} else if (orchestrator_om_round_mbtogb(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2558
						    curblkorder->partinfo.partition_size) > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2559
							/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2560
							 * In this scenario, partition size is large
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2561
							 * enough to be displayed but is not currently
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2562
							 * Check if there is a non displayed primary
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2563
							 * where this gap could be displayed.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2564
							 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2565
							update_partinfo_from_blkorder_and_display(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2566
							    partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2567
							    modpartinfo,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2568
							    curblkorder);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2569
						}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2570
					}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2571
				} else if (parttype != UNUSED) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2572
					break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2573
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2574
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2575
				if (diffgb == 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2576
					break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2577
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2578
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2579
			curblkorder = installationdisk_blkorder_getprev(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2580
			    modifiedprimaryblkorder[activedisk], curblkorder);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2581
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2582
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2583
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2584
	if (diffgb != 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2585
		g_warning("Some unused space not reduced : %f.\n", diffgb);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2586
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2587
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2588
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2589
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2590
logical_partition_spinner_focus_handler(GtkWidget *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2591
	GdkEventFocus *event,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2592
	gboolean sensitivity,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2593
	gpointer user_data)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2594
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2595
	gint pidx = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2596
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2597
	if (sensitivity == FALSE)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2598
		spinner_has_focus = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2599
	else
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2600
		spinner_has_focus = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2601
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2602
	/* Find starting point of logicalpartitions. */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2603
	for (pidx = 0; pidx < FD_NUMPART; pidx++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2604
		if (MainWindow.InstallationDiskWindow.startlogical[pidx] != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2605
			set_logical_combo_sensitivity(pidx, sensitivity, FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2606
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2607
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2608
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2609
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2610
static gboolean
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2611
logical_partition_spinner_focus_in_handler(GtkWidget *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2612
	GdkEventFocus *event,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2613
	gpointer user_data)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2614
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2615
#if defined(__i386)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2616
	logical_partition_spinner_focus_handler(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2617
	    widget, event, FALSE, user_data);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2618
#endif
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2619
	return (FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2620
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2621
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2622
static gboolean
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2623
logical_partition_spinner_focus_out_handler(GtkWidget *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2624
	GdkEventFocus *event,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2625
	gpointer user_data)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2626
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2627
#if defined(__i386)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2628
	logical_partition_spinner_focus_handler(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2629
	    widget, event, TRUE, user_data);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2630
#endif
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2631
	return (FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2632
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2633
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2634
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2635
logical_partition_spinner_value_changed(GtkWidget *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2636
	gpointer user_data)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2637
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2638
#if defined(__i386)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2639
	LogicalPartition *logicalpart = (LogicalPartition *)user_data;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2640
	partition_info_t *modpartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2641
	gfloat spinval = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2642
	gfloat partsize = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2643
	gfloat diffgb = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2644
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2645
	/* Block all other handlers why we set a few things */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2646
	disk_partitioning_block_all_handlers();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2647
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2648
	modpartinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2649
	    orchestrator_om_get_part_by_blkorder(modifiedpartitions[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2650
	    logicalpart->logpartindex);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2651
	g_assert(modpartinfo != NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2652
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2653
	/* Get difference between actual size and spinner size */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2654
	spinval = (gfloat)gtk_spin_button_get_value(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2655
	    GTK_SPIN_BUTTON(logicalpart->sizespinner));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2656
	partsize = orchestrator_om_round_mbtogb(modpartinfo->partition_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2657
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2658
	/* Single click of spin button would leave this as -1 or +1 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2659
	/* but user can enter text manually so can be > 1 or < -1 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2660
	diffgb = spinval - partsize;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2661
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2662
	logicalpart->sizechange = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2663
	update_data_loss_warnings();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2664
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2665
	update_logical_unused_partition_size_from_ui(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2666
	    modifiedpartitions[activedisk], logicalpart, diffgb);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2667
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2668
	update_disk_partitions_from_ui(modifiedpartitions[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2669
	logical_update_avail_space(modifiedpartitions[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2670
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2671
	g_object_set_data(G_OBJECT(diskbuttons[activedisk]),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2672
	    "modified",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2673
	    GINT_TO_POINTER(TRUE));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2674
	gtk_widget_set_sensitive(GTK_WIDGET(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2675
	    MainWindow.InstallationDiskWindow.resetbutton),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2676
	    TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2677
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2678
	/* Block all other handlers why we set a few things */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2679
	disk_partitioning_unblock_all_handlers();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2680
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2681
	g_debug("Logical Partition Spinner Changed");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2682
	print_partinfos(activedisk, alldiskinfo, modifiedpartitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2683
	print_blkorder(alldiskinfo[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2684
	    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2685
	    modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2686
	print_gui(MainWindow.InstallationDiskWindow);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2687
#endif
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2688
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2689
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2690
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2691
primary_partition_spinner_value_changed(GtkWidget *widget,
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2692
	gint index,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2693
	gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2694
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2695
#if defined(__i386)
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2696
	partition_info_t *modpartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2697
	GtkSpinButton *spinner = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2698
	gfloat spinval = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2699
	gfloat partsize = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2700
	gfloat diffgb = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2701
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2702
	/* Block all other handlers why we set a few things */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2703
	disk_partitioning_block_all_handlers();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2704
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2705
	modpartinfo = orchestrator_om_get_part_by_blkorder(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2706
	    modifiedpartitions[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2707
	    index);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2708
	g_assert(modpartinfo != NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2709
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2710
	/* Get difference between actual size and spinner size */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2711
	spinner = GTK_SPIN_BUTTON(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2712
	    MainWindow.InstallationDiskWindow.partspin[index]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2713
	spinval = (gfloat)gtk_spin_button_get_value(spinner);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2714
	partsize = orchestrator_om_round_mbtogb(modpartinfo->partition_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2715
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2716
	/* Single click of spin button would leave this as -1 or +1 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2717
	/* but user can enter text manually so can be > 1 or < -1 */
699
fa057c8df659 13972 Sometimes installer has unexpected insensitive Unused partition
Matt Keenan <matt.keenan@sun.com>
parents: 688
diff changeset
  2718
	diffgb = ONE_DECIMAL(spinval - partsize);
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2719
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2720
	turn_on_partsizechanges(index);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2721
	update_data_loss_warnings();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2722
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2723
	if (diffgb != 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2724
		update_primary_unused_partition_size_from_ui(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2725
		    modifiedpartitions[activedisk], index, diffgb);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2726
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2727
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2728
	update_disk_partitions_from_ui(modifiedpartitions[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2729
	primary_update_avail_space(modifiedpartitions[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2730
	primary_update_combo_sensitivity(modifiedpartitions[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2731
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2732
	if (diffgb != 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2733
		update_extended_partition(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2734
		    modifiedpartitions[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2735
		    index, diffgb);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2736
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2737
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2738
	g_object_set_data(G_OBJECT(diskbuttons[activedisk]),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2739
	    "modified",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2740
	    GINT_TO_POINTER(TRUE));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2741
	gtk_widget_set_sensitive(GTK_WIDGET(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2742
	    MainWindow.InstallationDiskWindow.resetbutton),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2743
	    TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2744
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2745
	/* Block all other handlers why we set a few things */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2746
	disk_partitioning_unblock_all_handlers();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2747
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2748
	g_debug("Primary Partition Spinner Changed");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2749
	print_partinfos(activedisk, alldiskinfo, modifiedpartitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2750
	print_blkorder(alldiskinfo[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2751
	    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2752
	    modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2753
	print_gui(MainWindow.InstallationDiskWindow);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2754
#endif
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2755
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2756
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2757
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2758
set_logical_combo_sensitivity(gint pidx,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2759
	gboolean sensitivity,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2760
	gboolean set_all)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2761
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2762
	LogicalPartition *curlogical;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2763
	int comboindex = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2764
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2765
	for (curlogical = MainWindow.InstallationDiskWindow.startlogical[pidx];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2766
	    curlogical != NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2767
	    curlogical = curlogical->next) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2768
		if (set_all == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2769
			gtk_widget_set_sensitive(curlogical->typecombo, sensitivity);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2770
		} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2771
			/* Only set the unused items */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2772
			comboindex = gtk_combo_box_get_active(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2773
			    GTK_COMBO_BOX(curlogical->typecombo));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2774
			if (comboindex == UNUSED_PARTITION) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2775
				gtk_widget_set_sensitive(curlogical->typecombo, sensitivity);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2776
			}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2777
		}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2778
	}
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2779
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2780
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2781
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2782
primary_partition_spinner_focus_handler(GtkWidget *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2783
	GdkEventFocus *event,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2784
	gint index,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2785
	gboolean sensitivity,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2786
	gpointer user_data)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2787
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2788
#if defined(__i386)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2789
	partition_info_t *modpartinfo;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2790
	gint parttype;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2791
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2792
	modpartinfo = orchestrator_om_get_part_by_blkorder(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2793
	    modifiedpartitions[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2794
	    index);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2795
	g_assert(modpartinfo != NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2796
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2797
	parttype = orchestrator_om_get_partition_type(modpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2798
	if (IS_EXT_PAR(parttype)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2799
		/* If editing an extended partition for the first time we */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2800
		/* want to de-sensitize all logicals */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2801
		if (MainWindow.InstallationDiskWindow.initialsizechange[index]
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2802
		    == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2803
			/* Scan through logicals and disable all logical combos */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2804
			set_logical_combo_sensitivity(index, sensitivity, TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2805
		} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2806
			/* Just de-sensitize the last unused item, as it has */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2807
			/* the potential of being destroyed */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2808
			if (MainWindow.InstallationDiskWindow.numpartlogical[index] == 1) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2809
				/* Set to sensitive all the time regardless */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2810
				set_logical_combo_sensitivity(index, TRUE, FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2811
			} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2812
				/* Just set the unused items */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2813
				set_logical_combo_sensitivity(index, sensitivity, FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2814
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2815
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2816
	}
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2817
#endif
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2818
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2819
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2820
void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2821
partition_0_spinner_value_changed(GtkWidget *widget, gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2822
{
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2823
	primary_partition_spinner_value_changed(widget, 0, user_data);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2824
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2825
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2826
void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2827
partition_1_spinner_value_changed(GtkWidget *widget, gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2828
{
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2829
	primary_partition_spinner_value_changed(widget, 1, user_data);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2830
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2831
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2832
void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2833
partition_2_spinner_value_changed(GtkWidget *widget, gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2834
{
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2835
	primary_partition_spinner_value_changed(widget, 2, user_data);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2836
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2837
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2838
void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2839
partition_3_spinner_value_changed(GtkWidget *widget, gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2840
{
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2841
	primary_partition_spinner_value_changed(widget, 3, user_data);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2842
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2843
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2844
gboolean
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2845
partition_0_spinner_focus_in_handler(GtkWidget *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2846
	GdkEventFocus *event,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2847
	gpointer user_data)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2848
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2849
	primary_partition_spinner_focus_handler(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2850
	    widget, event, 0, FALSE, user_data);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2851
	return (FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2852
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2853
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2854
gboolean
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2855
partition_1_spinner_focus_in_handler(GtkWidget *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2856
	GdkEventFocus *event,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2857
	gpointer user_data)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2858
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2859
	primary_partition_spinner_focus_handler(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2860
	    widget, event, 1, FALSE, user_data);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2861
	return (FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2862
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2863
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2864
gboolean
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2865
partition_2_spinner_focus_in_handler(GtkWidget *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2866
	GdkEventFocus *event,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2867
	gpointer user_data)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2868
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2869
	primary_partition_spinner_focus_handler(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2870
	    widget, event, 2, FALSE, user_data);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2871
	return (FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2872
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2873
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2874
gboolean
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2875
partition_3_spinner_focus_in_handler(GtkWidget *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2876
	GdkEventFocus *event,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2877
	gpointer user_data)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2878
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2879
	primary_partition_spinner_focus_handler(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2880
	    widget, event, 3, FALSE, user_data);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2881
	return (FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2882
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2883
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2884
gboolean
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2885
partition_0_spinner_focus_out_handler(GtkWidget *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2886
	GdkEventFocus *event,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2887
	gpointer user_data)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2888
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2889
	primary_partition_spinner_focus_handler(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2890
	    widget, event, 0, TRUE, user_data);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2891
	return (FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2892
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2893
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2894
gboolean
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2895
partition_1_spinner_focus_out_handler(GtkWidget *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2896
	GdkEventFocus *event,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2897
	gpointer user_data)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2898
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2899
	primary_partition_spinner_focus_handler(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2900
	    widget, event, 1, TRUE, user_data);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2901
	return (FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2902
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2903
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2904
gboolean
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2905
partition_2_spinner_focus_out_handler(GtkWidget *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2906
	GdkEventFocus *event,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2907
	gpointer user_data)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2908
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2909
	primary_partition_spinner_focus_handler(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2910
	    widget, event, 2, TRUE, user_data);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2911
	return (FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2912
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2913
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2914
gboolean
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2915
partition_3_spinner_focus_out_handler(GtkWidget *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2916
	GdkEventFocus *event,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2917
	gpointer user_data)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2918
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2919
	primary_partition_spinner_focus_handler(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2920
	    widget, event, 3, TRUE, user_data);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2921
	return (FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2922
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2923
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2924
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2925
reset_primary_partitions(gboolean block_handlers)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2926
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2927
	gint i = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2928
	gpointer objectdata = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2929
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2930
	if (block_handlers)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2931
		disk_partitioning_block_all_handlers();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2932
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2933
	disk_comboboxes_ui_reset();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2934
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2935
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2936
	 * Traverse through all partitions, if logical partitions created
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2937
	 * Remove them and collapse back to just 4 primary partitions
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2938
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2939
	for (i = 0; i < FD_NUMPART; i++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2940
		if (MainWindow.InstallationDiskWindow.startlogical[i] != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2941
			logical_partitions_remove_all_ui(i);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2942
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2943
		/* Initialize some other variables aswell */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2944
		MainWindow.InstallationDiskWindow.partcombosaved[i] = UNUSED_PARTITION;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2945
		MainWindow.InstallationDiskWindow.parttypechanges[i] = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2946
		MainWindow.InstallationDiskWindow.partsizechanges[i] = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2947
		MainWindow.InstallationDiskWindow.initialsizechange[i] = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2948
		MainWindow.InstallationDiskWindow.partrow[i] = i+1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2949
		MainWindow.InstallationDiskWindow.startlogical[i] = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2950
		MainWindow.InstallationDiskWindow.numpartlogical[i] = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2951
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2952
		gtk_spin_button_set_range(GTK_SPIN_BUTTON(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2953
		    MainWindow.InstallationDiskWindow.partspin[i]),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2954
		    0, 0);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2955
		gtk_spin_button_set_value(GTK_SPIN_BUTTON(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2956
		    MainWindow.InstallationDiskWindow.partspin[i]), 0);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2957
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2958
		gtk_label_set_text(GTK_LABEL(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2959
		    MainWindow.InstallationDiskWindow.partavail[i]), "0.0");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2960
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2961
		/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2962
		 * Remove any items previously added to display
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2963
		 * existing, unmodifiable partition types
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2964
		 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2965
		objectdata = g_object_get_data(G_OBJECT(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2966
		    MainWindow.InstallationDiskWindow.partcombo[i]), "extra_fs");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2967
		if ((objectdata != NULL) && (GPOINTER_TO_INT(objectdata) == TRUE)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2968
			g_object_set_data(G_OBJECT(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2969
			    MainWindow.InstallationDiskWindow.partcombo[i]),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2970
			    "extra_fs",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2971
			    GINT_TO_POINTER(FALSE));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2972
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2973
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2974
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2975
	update_data_loss_warnings();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2976
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2977
	if (block_handlers)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2978
		disk_partitioning_unblock_all_handlers();
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2979
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2980
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2981
void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2982
disk_partitioning_reset_button_clicked(GtkWidget *widget, gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2983
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2984
#if defined(__i386)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2985
	gint i = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2986
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2987
	if (activedisk < 0)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2988
		return;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2989
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2990
	om_free_disk_partition_info(omhandle, modifiedpartitions[activedisk]);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2991
	switch (get_disk_status(activedisk)) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2992
		case DISK_STATUS_OK:
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2993
			modifiedpartitions[activedisk] =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2994
			    orchestrator_om_partitions_dup(originalpartitions[activedisk]);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2995
			break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2996
		case DISK_STATUS_CANT_PRESERVE:
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2997
			modifiedpartitions[activedisk] =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  2998
			    orchestrator_om_partitions_dup(defaultpartitions[activedisk]);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  2999
			break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3000
		case DISK_STATUS_TOO_SMALL:
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3001
			g_warning("It shouldn't have been possible to"
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3002
			    "partition a disk that's too small\n");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3003
			break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3004
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3005
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3006
	/* Pretty sure we don't need this guy */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3007
	/* installationdisk_get_original_blkorder_layout(activedisk); */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3008
	installationdisk_blkorder_free_list(modifiedprimaryblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3009
	installationdisk_blkorder_free_list(modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3010
	modifiedprimaryblkorder[activedisk] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3011
	    installationdisk_blkorder_dup(originalprimaryblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3012
	modifiedlogicalblkorder[activedisk] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3013
	    installationdisk_blkorder_dup(originallogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3014
	initialize_default_partition_layout(activedisk);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3015
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3016
	update_data_loss_warnings();
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3017
	/* Flag for the the reset button to be disabled */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3018
	g_object_set_data(G_OBJECT(diskbuttons[activedisk]),
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3019
	    "modified",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3020
	    GINT_TO_POINTER(FALSE));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3021
	disk_selection_set_active_disk(activedisk);
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3022
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3023
	g_debug("reset button pressed");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3024
	print_partinfos(activedisk, alldiskinfo, modifiedpartitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3025
	print_blkorder(alldiskinfo[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3026
	    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3027
	    modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3028
	print_gui(MainWindow.InstallationDiskWindow);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3029
#endif /* (__i386) */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3030
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3031
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3032
/* Internally referenced callbacks */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3033
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3034
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3035
installationdisk_diskbutton_toggled(GtkWidget *widget, gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3036
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3037
	gint disknum;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3038
	disknum = GPOINTER_TO_INT(user_data);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3039
	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)) == FALSE)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3040
		return;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3041
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3042
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3043
	 * Set new disk selected, this will initialize display back to
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3044
	 * default then set it to contents of this disks modifiedpartitions
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3045
	 */
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3046
	disk_selection_set_active_disk(disknum);
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3047
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3048
	g_debug("After Current Active Disk :");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3049
	print_partinfos(activedisk, alldiskinfo, modifiedpartitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3050
	print_blkorder(alldiskinfo[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3051
	    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3052
	    modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3053
	print_gui(MainWindow.InstallationDiskWindow);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3054
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3055
500
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  3056
/* Toggle the button when it gets the focus. */
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  3057
static gboolean
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  3058
installationdisk_diskbutton_focused(GtkWidget *widget,
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3059
	GdkEventFocus *event,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3060
	gpointer user_data)
500
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  3061
{
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  3062
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3063
	    !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)));
500
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  3064
	return (FALSE);
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  3065
}
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  3066
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3067
/* UI initialisation functoins */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3068
void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3069
installationdisk_xml_init(void)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3070
{
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3071
	gint i = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3072
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3073
	MainWindow.installationdiskwindowxml =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3074
	    glade_xml_new(GLADEDIR "/" INSTALLATIONDISKFILENAME,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3075
	    DISKNODE, NULL);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3076
	MainWindow.InstallationDiskWindow.diskselectiontoplevel =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3077
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3078
	    "diskselectiontoplevel");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3079
	MainWindow.InstallationDiskWindow.custompartitioningvbox =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3080
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3081
	    "custompartitioningvbox");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3082
	MainWindow.InstallationDiskWindow.disksviewport =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3083
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3084
	    "disksviewport");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3085
	MainWindow.InstallationDiskWindow.diskselectionhscrollbar =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3086
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3087
	    "diskselectionhscrollbar");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3088
	MainWindow.InstallationDiskWindow.diskerrorimage =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3089
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3090
	    "diskerrorimage");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3091
	MainWindow.InstallationDiskWindow.diskwarningimage =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3092
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3093
	    "diskwarningimage");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3094
	MainWindow.InstallationDiskWindow.diskstatuslabel =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3095
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3096
	    "diskstatuslabel");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3097
	MainWindow.InstallationDiskWindow.diskwarninghbox =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3098
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3099
	    "diskwarninghbox");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3100
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3101
	MainWindow.InstallationDiskWindow.fdiskscrolledwindow =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3102
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3103
	    "fdiskscrolledwindow");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3104
	MainWindow.InstallationDiskWindow.fdiskviewport =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3105
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3106
	    "fdiskviewport");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3107
	MainWindow.InstallationDiskWindow.fdisktable =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3108
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3109
	    "fdisktable");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3110
	MainWindow.InstallationDiskWindow.fdisktablerows =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3111
	    GUI_INSTALL_FDISK_TABLE_ROWS;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3112
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3113
	/* Partition combo boxes */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3114
	MainWindow.InstallationDiskWindow.partcombo[0] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3115
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3116
	    "partition0combo");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3117
	MainWindow.InstallationDiskWindow.partcombo[1] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3118
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3119
	    "partition1combo");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3120
	MainWindow.InstallationDiskWindow.partcombo[2] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3121
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3122
	    "partition2combo");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3123
	MainWindow.InstallationDiskWindow.partcombo[3] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3124
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3125
	    "partition3combo");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3126
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3127
	/* Partition spin buttons */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3128
	MainWindow.InstallationDiskWindow.partspin[0] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3129
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3130
	    "partition0spinner");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3131
	MainWindow.InstallationDiskWindow.partspin[1] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3132
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3133
	    "partition1spinner");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3134
	MainWindow.InstallationDiskWindow.partspin[2] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3135
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3136
	    "partition2spinner");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3137
	MainWindow.InstallationDiskWindow.partspin[3] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3138
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3139
	    "partition3spinner");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3140
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3141
	/* Partition avail labels */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3142
	MainWindow.InstallationDiskWindow.partavail[0] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3143
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3144
	    "partition0avail");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3145
	MainWindow.InstallationDiskWindow.partavail[1] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3146
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3147
	    "partition1avail");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3148
	MainWindow.InstallationDiskWindow.partavail[2] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3149
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3150
	    "partition2avail");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3151
	MainWindow.InstallationDiskWindow.partavail[3] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3152
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3153
	    "partition3avail");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3154
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3155
	/* Partition warning messages */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3156
	MainWindow.InstallationDiskWindow.partwarnbox[0] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3157
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3158
	    "partition0warninghbox");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3159
	MainWindow.InstallationDiskWindow.partwarnbox[1] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3160
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3161
	    "partition1warninghbox");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3162
	MainWindow.InstallationDiskWindow.partwarnbox[2] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3163
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3164
	    "partition2warninghbox");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3165
	MainWindow.InstallationDiskWindow.partwarnbox[3] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3166
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3167
	    "partition3warninghbox");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3168
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3169
	MainWindow.InstallationDiskWindow.resetbutton =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3170
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3171
	    "fdiskresetbutton");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3172
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3173
	/* Initialize widgets to default values */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3174
	reset_primary_partitions(TRUE);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3175
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3176
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3177
/*
50
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3178
 * Update the disk icons to match the new icon theme
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3179
 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3180
void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3181
icon_theme_changed(GtkIconTheme *theme, gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3182
{
50
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3183
	gint disknum;
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3184
	DiskStatus status;
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3185
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3186
	for (disknum = 0; disknum < numdisks; disknum++) {
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3187
		status = get_disk_status(disknum);
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3188
		if (status == DISK_STATUS_NO_DISKINFO)
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3189
			continue;
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3190
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3191
		set_diskbutton_icon(GTK_WIDGET(diskbuttons[disknum]),
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3192
		    create_diskbutton_icon(status, alldiskinfo[disknum]));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3193
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3194
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3195
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3196
/* For each combobox, update width if need be because of style change */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3197
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3198
disk_update_combobox_widths(void)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3199
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3200
	gint i = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3201
	GtkCellRenderer *renderer = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3202
	GList *cells = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3203
	gint new_width = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3204
	gint cur_width = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3205
	gint cur_height = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3206
	LogicalPartition *curlogical = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3207
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3208
	new_width = get_max_cell_renderer_width();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3209
	new_width = new_width+1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3210
	if (new_width == max_combo_width)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3211
		return;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3212
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3213
	max_combo_width = new_width;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3214
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3215
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3216
	 * Loop through each primary partition combobox setting new max width
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3217
	 * if required
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3218
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3219
	for (i = 0; i < FD_NUMPART; i++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3220
		cells = gtk_cell_layout_get_cells(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3221
		    GTK_CELL_LAYOUT(MainWindow.InstallationDiskWindow.partcombo[i]));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3222
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3223
		/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3224
		 * We know there's only one cell renderer per combobox so just use
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3225
		 * first list element
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3226
		 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3227
		renderer = (GtkCellRenderer *)cells->data;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3228
		gtk_cell_renderer_set_fixed_size(renderer,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3229
		    max_combo_width+LOGICAL_COMBOBOX_INDENT, -1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3230
		g_list_free(cells);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3231
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3232
		if (MainWindow.InstallationDiskWindow.startlogical[i] != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3233
			/* Cycle through all logical partition combo's */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3234
			for (curlogical = MainWindow.InstallationDiskWindow.startlogical[i];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3235
			    curlogical != NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3236
			    curlogical = curlogical->next) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3237
				cells = gtk_cell_layout_get_cells(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3238
				    GTK_CELL_LAYOUT(curlogical->typecombo));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3239
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3240
				renderer = (GtkCellRenderer *)cells->data;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3241
				gtk_cell_renderer_set_fixed_size(renderer, max_combo_width, -1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3242
				g_list_free(cells);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3243
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3244
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3245
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3246
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3247
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3248
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3249
void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3250
combobox_style_set(GtkWidget *widget, GtkStyle *style, gpointer user_data)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3251
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3252
	GtkCellRenderer *renderer = (GtkCellRenderer *)user_data;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3253
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3254
	if (style != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3255
		/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3256
		 * Possible reset all gtkcombo box widths
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3257
		 * ensures against label clipping if font size has changed
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3258
		 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3259
		disk_update_combobox_widths();
50
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3260
	}
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3261
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3262
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3263
void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3264
installationdisk_ui_init(void)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3265
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3266
	GdkColor backcolour;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3267
	gchar *minsizetext = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3268
	gint i = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3269
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3270
	icontheme = gtk_icon_theme_get_default();
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3271
84
4bb57dfd1e77 968 Minimum disk size is smaller than it should be
niall@localhost
parents: 50
diff changeset
  3272
	minsizetext = g_strdup_printf(_("Recommended size: %lldGB Minimum: %.1fGB"),
4bb57dfd1e77 968 Minimum disk size is smaller than it should be
niall@localhost
parents: 50
diff changeset
  3273
	    orchestrator_om_get_recommended_sizegb(),
4bb57dfd1e77 968 Minimum disk size is smaller than it should be
niall@localhost
parents: 50
diff changeset
  3274
	    orchestrator_om_get_mininstall_sizegb(TRUE));
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3275
	gtk_label_set_text(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3276
	    GTK_LABEL(MainWindow.screentitlesublabel2), minsizetext);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3277
	g_free(minsizetext);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3278
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3279
	disk_viewport_ui_init(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3280
	    GTK_VIEWPORT(MainWindow.InstallationDiskWindow.disksviewport));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3281
	disk_comboboxes_ui_init();
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3282
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3283
	gtk_box_pack_start(GTK_BOX(MainWindow.screencontentvbox),
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3284
	    MainWindow.InstallationDiskWindow.diskselectiontoplevel,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3285
	    TRUE,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3286
	    TRUE,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3287
	    0);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3288
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3289
	gdk_color_parse(WHITE_COLOR, &backcolour);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3290
	gtk_widget_modify_bg(MainWindow.InstallationDiskWindow.disksviewport,
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3291
	    GTK_STATE_NORMAL, &backcolour);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3292
	gtk_widget_modify_bg(MainWindow.InstallationDiskWindow.fdiskviewport,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3293
	    GTK_STATE_NORMAL, &backcolour);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3294
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3295
	/* Initially hide all partitioning controls until a disk is selected */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3296
	gtk_widget_hide(glade_xml_get_widget(MainWindow.installationdiskwindowxml,
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3297
	    "partitioningvbox"));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3298
	/* Custom partitioning is not shown initially */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3299
	gtk_widget_hide(MainWindow.InstallationDiskWindow.custompartitioningvbox);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3300
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3301
	/* Connect up scrollbar's adjustment to the viewport */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3302
	viewportadjustment = gtk_range_get_adjustment(GTK_RANGE
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3303
	    (MainWindow.InstallationDiskWindow.diskselectionhscrollbar));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3304
	g_signal_connect(G_OBJECT(viewportadjustment),
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3305
	    "changed",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3306
	    G_CALLBACK(viewport_adjustment_changed),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3307
	    (gpointer)MainWindow.InstallationDiskWindow.diskselectionhscrollbar);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3308
	gtk_viewport_set_hadjustment(GTK_VIEWPORT
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3309
	    (MainWindow.InstallationDiskWindow.disksviewport),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3310
	    viewportadjustment);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3311
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3312
	/* Filter keyboard input on spinbuttons */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3313
	for (i = 0; i < FD_NUMPART; i++) {
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3314
		spininserthandlers[i] = g_signal_connect(G_OBJECT
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3315
		    (MainWindow.InstallationDiskWindow.partspin[i]),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3316
		    "insert-text",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3317
		    G_CALLBACK(spinners_insert_text_filter),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3318
		    GINT_TO_POINTER(i));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3319
		spindeletehandlers[i] = g_signal_connect(G_OBJECT
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3320
		    (MainWindow.InstallationDiskWindow.partspin[i]),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3321
		    "delete-text",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3322
		    G_CALLBACK(spinners_delete_text_filter),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3323
		    GINT_TO_POINTER(i));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3324
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3325
	glade_xml_signal_autoconnect(MainWindow.installationdiskwindowxml);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3326
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3327
	g_signal_connect(G_OBJECT(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3328
	    MainWindow.InstallationDiskWindow.diskstatuslabel), "style-set",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3329
	    G_CALLBACK(combobox_style_set),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3330
	    (gpointer) NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3331
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3332
	if (MainWindow.MileStoneComplete[OM_UPGRADE_TARGET_DISCOVERY] == FALSE) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3333
		g_timeout_add(200, partition_discovery_monitor, NULL);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3334
	} else { /* Go straight to disk display function */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3335
		partition_discovery_monitor(NULL);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3336
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3337
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3338
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3339
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3340
initialize_default_partition_layout(gint disknum)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3341
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3342
	disk_info_t *diskinfo = alldiskinfo[disknum];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3343
	disk_parts_t *partitions = modifiedpartitions[disknum];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3344
	gint logpartindex, primpartindex;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3345
	partition_info_t *primpartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3346
	partition_info_t *logpartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3347
	partition_info_t *freepartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3348
	gboolean haveunused = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3349
	gint primparttype, logparttype;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3350
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3351
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3352
	 * Disks are to be displayed in Block Order which is determined via
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3353
	 * pinfo->partition_order
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3354
	 * Process 4 possible primary partitions if one array entry is not set
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3355
	 * then allocate an unused block to this partition entry.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3356
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3357
	for (primpartindex = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3358
	    primpartindex < FD_NUMPART;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3359
	    primpartindex++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3360
		primpartinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3361
		    orchestrator_om_get_part_by_blkorder(partitions, primpartindex);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3362
		if (!primpartinfo) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3363
			/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3364
			 * Partition not found for this order point,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3365
			 * Indicates partition does not exist at this order point or we
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3366
			 * have gone beyond the maximum
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3367
			 * Either way, as we as calculating primary partitions here and
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3368
			 * 4 primary partitions are always displayed, set this pinfo[i]
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3369
			 * Element to unused, so it can be displayed, and assign a free
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3370
			 * block of space if it exists
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3371
			 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3372
			primpartinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3373
			    orchestrator_om_find_unused_primary_partition(partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3374
			    UNUSED,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3375
			    primpartindex);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3376
			g_assert(primpartinfo != NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3377
			freepartinfo = installationdisk_get_largest_free_block(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3378
			    disknum, TRUE,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3379
			    modifiedprimaryblkorder[disknum],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3380
			    primpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3381
			if (freepartinfo) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3382
				primpartinfo->partition_size = freepartinfo->partition_size;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3383
				primpartinfo->partition_offset = freepartinfo->partition_offset;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3384
				primpartinfo->content_type = freepartinfo->content_type;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3385
				primpartinfo->active = freepartinfo->active;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3386
				primpartinfo->partition_offset_sec =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3387
				    freepartinfo->partition_offset_sec;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3388
				primpartinfo->partition_size_sec =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3389
				    freepartinfo->partition_size_sec;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3390
				haveunused = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3391
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3392
		} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3393
			primparttype = orchestrator_om_get_partition_type(primpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3394
			if (IS_EXT_PAR(primparttype)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3395
				/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3396
				 * Process Logical disks, ensuring all gaps are filled in
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3397
				 * And ensuring we have at least one disk
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3398
				 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3399
				for (logpartindex = FD_NUMPART;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3400
				    logpartindex < OM_NUMPART;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3401
				    logpartindex++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3402
					logpartinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3403
					    orchestrator_om_get_part_by_blkorder(partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3404
					    logpartindex);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3405
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3406
					if (!logpartinfo) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3407
						/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3408
						 * For each of the unused blocks between logicals
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3409
						 * Add a new item, if space at the end add one
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3410
						 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3411
						while (installationdisk_get_largest_free_block(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3412
						    disknum, FALSE,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3413
						    modifiedlogicalblkorder[disknum], NULL) != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3414
							/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3415
							 * Found a usable free block, allocate a new
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3416
							 * Logical element to cater for this free block
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3417
							 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3418
							logpartinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3419
							    orchestrator_om_find_unused_logical_partition(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3420
							    partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3421
							    UNUSED,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3422
							    logpartindex);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3423
							g_assert(logpartinfo != NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3424
							freepartinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3425
							    installationdisk_get_largest_free_block(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3426
							    disknum, TRUE,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3427
							    modifiedlogicalblkorder[disknum],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3428
							    logpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3429
							g_assert(freepartinfo != NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3430
							logpartinfo->partition_size =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3431
							    freepartinfo->partition_size;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3432
							logpartinfo->partition_offset =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3433
							    freepartinfo->partition_offset;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3434
							logpartinfo->content_type =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3435
							    freepartinfo->content_type;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3436
							logpartinfo->active = freepartinfo->active;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3437
							logpartinfo->partition_offset_sec =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3438
							    freepartinfo->partition_offset_sec;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3439
							logpartinfo->partition_size_sec =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3440
							    freepartinfo->partition_size_sec;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3441
							haveunused = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3442
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3443
							/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3444
							 * Increment logical partition id, and validate
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3445
							 * to within logical limits of < OM_NUMPART
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3446
							 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3447
							if (++logpartindex >= OM_NUMPART)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3448
								break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3449
						}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3450
						break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3451
					}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3452
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3453
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3454
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3455
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3456
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3457
	if (haveunused == TRUE) {
699
fa057c8df659 13972 Sometimes installer has unexpected insensitive Unused partition
Matt Keenan <matt.keenan@sun.com>
parents: 688
diff changeset
  3458
		installationdisk_reorder_to_blkorder(partitions,
715
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  3459
		    modifiedprimaryblkorder[disknum],
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  3460
		    modifiedlogicalblkorder[disknum]);
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3461
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3462
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3463
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3464
/* Initialises UI widgets for the selected disk */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3465
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3466
disk_selection_set_active_disk(int disknum)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3467
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3468
	GtkToggleButton *usewholediskradio;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3469
	DiskStatus status;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3470
	gchar *markup;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3471
	gint partitionsmodified = 0;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3472
	gint i = 0;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3473
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3474
	disk_partitioning_block_all_handlers();
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3475
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3476
	activedisk = disknum;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3477
	/* First see if the disk is large enough for installation */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3478
	status = get_disk_status(disknum);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3479
	switch (status) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3480
		case DISK_STATUS_OK:
233
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3481
			/*
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3482
			 * If disk is too big, display warning
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3483
			 * in icon message area
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3484
			 */
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3485
			if (disk_is_too_big(alldiskinfo[disknum])) {
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3486
				markup = g_strdup_printf("<span font_desc="
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3487
				    "\"Bold\">%s</span>",
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3488
				    _("Usable size limited to 2TB"));
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3489
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3490
				gtk_widget_show(MainWindow.
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3491
				    InstallationDiskWindow.diskwarningimage);
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3492
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3493
				gtk_label_set_markup(GTK_LABEL
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3494
				    (MainWindow.InstallationDiskWindow.diskstatuslabel),
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3495
				    markup);
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3496
				gtk_widget_show(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3497
				    MainWindow.InstallationDiskWindow.diskstatuslabel);
233
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3498
			} else {
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3499
				markup = g_strdup(" ");
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3500
				gtk_widget_hide(MainWindow.
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3501
				    InstallationDiskWindow.diskwarningimage);
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3502
				gtk_label_set_text(GTK_LABEL
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3503
				    (MainWindow.InstallationDiskWindow.diskstatuslabel),
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3504
				    markup);
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3505
			}
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3506
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3507
			disk_partitioning_set_sensitive(TRUE);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3508
			gtk_widget_hide(MainWindow.InstallationDiskWindow.diskerrorimage);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3509
			activediskisreadable = TRUE;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3510
			gtk_widget_hide(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3511
			    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3512
			    "unreadablepartsouterhbox"));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3513
			gtk_widget_show(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3514
			    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3515
			    "partsfoundlabel"));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3516
			g_free(markup);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3517
			break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3518
		case DISK_STATUS_TOO_SMALL:
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3519
			markup = g_strdup_printf("<span font_desc=\"Bold\">%s</span>",
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3520
			    _("This disk is too small"));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3521
			disk_partitioning_set_sensitive(FALSE);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3522
			gtk_label_set_markup(GTK_LABEL
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3523
			    (MainWindow.InstallationDiskWindow.diskstatuslabel),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3524
			    markup);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3525
			g_free(markup);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3526
			gtk_widget_show(MainWindow.InstallationDiskWindow.diskstatuslabel);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3527
			gtk_widget_hide(MainWindow.InstallationDiskWindow.diskwarningimage);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3528
			gtk_widget_show(MainWindow.InstallationDiskWindow.diskerrorimage);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3529
			break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3530
		case DISK_STATUS_NO_MEDIA:
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3531
			markup = g_strdup_printf("<span font_desc=\"Bold\">%s</span>",
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3532
			    _("This storage device contains no media"));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3533
			disk_partitioning_set_sensitive(FALSE);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3534
			gtk_label_set_markup(GTK_LABEL
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3535
			    (MainWindow.InstallationDiskWindow.diskstatuslabel),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3536
			    markup);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3537
			g_free(markup);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3538
			gtk_widget_show(MainWindow.InstallationDiskWindow.diskstatuslabel);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3539
			gtk_widget_hide(MainWindow.InstallationDiskWindow.diskwarningimage);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3540
			gtk_widget_show(MainWindow.InstallationDiskWindow.diskerrorimage);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3541
			break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3542
		case DISK_STATUS_CANT_PRESERVE:
233
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3543
			/*
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3544
			 * If disk is too big and/or partition
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3545
			 * configuration can't be preserved, display
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3546
			 * warning in icon message area
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3547
			 */
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3548
			if (disk_is_too_big(alldiskinfo[disknum])) {
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3549
				markup = g_strdup_printf("<span font_desc="
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3550
				    "\"Bold\">%s</span>",
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3551
				    _("The entire disk will be erased, "
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3552
				    "usable size limited to 2TB"));
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3553
			} else {
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3554
				markup = g_strdup_printf("<span font_desc="
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3555
				    "\"Bold\">%s</span>",
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3556
				    _("The entire disk will be erased"));
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3557
			}
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3558
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3559
			disk_partitioning_set_sensitive(TRUE);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3560
			gtk_label_set_markup(GTK_LABEL
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3561
			    (MainWindow.InstallationDiskWindow.diskstatuslabel),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3562
			    markup);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3563
			g_free(markup);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3564
			gtk_widget_show(MainWindow.InstallationDiskWindow.diskstatuslabel);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3565
			gtk_widget_hide(MainWindow.InstallationDiskWindow.diskerrorimage);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3566
			gtk_widget_show(MainWindow.InstallationDiskWindow.diskwarningimage);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3567
			break;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3568
		case DISK_STATUS_LARGE_WARNING:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3569
			markup = g_strdup_printf("<span font_desc=\"Bold\">%s</span>",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3570
			    _("Usable size limited to 2TB"));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3571
			disk_partitioning_set_sensitive(TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3572
			gtk_label_set_markup(GTK_LABEL
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3573
			    (MainWindow.InstallationDiskWindow.diskstatuslabel),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3574
			    markup);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3575
			g_free(markup);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3576
			gtk_widget_show(MainWindow.InstallationDiskWindow.diskstatuslabel);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3577
			gtk_widget_show(MainWindow.InstallationDiskWindow.diskwarningimage);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3578
			gtk_widget_hide(MainWindow.InstallationDiskWindow.diskerrorimage);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3579
			break;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3580
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3581
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3582
#if defined(__i386)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3583
	/* Create a default, single partition layout for the disk */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3584
	if (defaultpartitions[disknum] == NULL) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3585
		defaultpartitions[disknum] =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3586
		    installation_disk_create_default_layout(alldiskinfo[disknum]);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3587
	}
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3588
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3589
	/* Create initial partitioning layouts if necessary */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3590
	if (originalpartitions[disknum] == NULL) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3591
		if (status == DISK_STATUS_OK) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3592
			disk_parts_t *partitions;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3593
			char *diskname = g_strdup(alldiskinfo[disknum]->disk_name);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3594
			partitions = orchestrator_om_get_disk_partitions(omhandle,
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3595
			    diskname);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3596
			originalpartitions[disknum] =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3597
			    orchestrator_om_partitions_dup(partitions);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3598
			om_free_disk_partition_info(omhandle, partitions);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3599
			g_free(diskname);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3600
			modifiedpartitions[disknum] =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3601
			    orchestrator_om_partitions_dup(originalpartitions[disknum]);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3602
		} else if (status == DISK_STATUS_CANT_PRESERVE) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3603
			/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3604
			 * No original partitions can be read so just set it to the
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3605
			 * the default partitioning layout.
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3606
			 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3607
			originalpartitions[disknum] =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3608
			    orchestrator_om_partitions_dup(defaultpartitions[disknum]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3609
			modifiedpartitions[disknum] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3610
			    orchestrator_om_partitions_dup(defaultpartitions[disknum]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3611
		} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3612
			originalpartitions[disknum] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3613
			    orchestrator_om_partitions_dup(defaultpartitions[disknum]);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3614
			modifiedpartitions[disknum] =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3615
			    orchestrator_om_partitions_dup(defaultpartitions[disknum]);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3616
		}
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3617
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3618
		/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3619
		 * Process modifiedpartitions[disknum], and set up what an initial
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3620
		 * display should look like including free gaps etc..
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3621
		 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3622
		g_debug("Before Set Current Active Disk :");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3623
		print_partinfos(activedisk, alldiskinfo, modifiedpartitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3624
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3625
		/* Get original block order layout */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3626
		installationdisk_get_blkorder_layout(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3627
		    alldiskinfo[disknum],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3628
		    originalpartitions[disknum],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3629
		    &originalprimaryblkorder[disknum],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3630
		    &originallogicalblkorder[disknum]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3631
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3632
		modifiedprimaryblkorder[disknum] = installationdisk_blkorder_dup(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3633
		    originalprimaryblkorder[disknum]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3634
		modifiedlogicalblkorder[disknum] = installationdisk_blkorder_dup(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3635
		    originallogicalblkorder[disknum]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3636
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3637
		initialize_default_partition_layout(disknum);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3638
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3639
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3640
	if (status == DISK_STATUS_CANT_PRESERVE) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3641
		activediskisreadable = FALSE;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3642
		gtk_widget_hide(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3643
		    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3644
		    "partsfoundlabel"));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3645
		gtk_widget_show(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3646
		    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3647
		    "unreadablepartsouterhbox"));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3648
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3649
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3650
	if ((status == DISK_STATUS_OK) || (status == DISK_STATUS_CANT_PRESERVE)) {
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3651
		disk_partitioning_set_from_parts_data(alldiskinfo[disknum],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3652
		    modifiedpartitions[disknum]);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3653
		usewholediskradio = GTK_TOGGLE_BUTTON
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3654
		    (glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3655
		    "wholediskradio"));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3656
		if (gtk_toggle_button_get_active(usewholediskradio) == TRUE)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3657
			proposedpartitions[disknum] = defaultpartitions[disknum];
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3658
		else
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3659
			proposedpartitions[disknum] = modifiedpartitions[disknum];
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3660
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3661
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3662
	update_data_loss_warnings();
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3663
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3664
	partitionsmodified = GPOINTER_TO_INT(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3665
	    g_object_get_data(G_OBJECT
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3666
	    (diskbuttons[disknum]),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3667
	    "modified"));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3668
	gtk_widget_set_sensitive(GTK_WIDGET
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3669
	    (MainWindow.InstallationDiskWindow.resetbutton),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3670
	    partitionsmodified);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3671
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3672
#endif
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3673
	disk_partitioning_unblock_all_handlers();
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3674
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3675
	activedisk = disknum;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3676
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3677
50
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3678
/*
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3679
 * Create an icon for the disk with an emblem if necessary
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3680
 */
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3681
static GtkWidget *
233
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3682
create_diskbutton_icon(DiskStatus status, disk_info_t *diskinfo)
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3683
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3684
	GtkIconInfo *diskiconinfo;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3685
	GtkIconInfo *emblemiconinfo = NULL;
50
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3686
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3687
	GtkWidget *diskbaseimage;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3688
	GdkPixbuf *diskbasepixbuf;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3689
	GdkPixbuf *emblempixbuf;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3690
	gint diskwidth, diskheight;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3691
	gint emblemwidth, emblemheight;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3692
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3693
	const gchar *diskfilename, *emblemfilename = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3694
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3695
	/*
50
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3696
	 * Icon size has to be hardcoded to 48 rather than using
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3697
	 * GTK_ICON_SIZE_DIALOG or it looks too small.
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3698
	 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3699
	if (status == DISK_STATUS_NO_MEDIA) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3700
		diskiconinfo = gtk_icon_theme_lookup_icon(icontheme,
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3701
		    "gnome-dev-removable",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3702
		    48,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3703
		    0);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3704
	} else {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3705
		diskiconinfo = gtk_icon_theme_lookup_icon(icontheme,
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3706
		    "gnome-dev-harddisk",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3707
		    48,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3708
		    0);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3709
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3710
	diskfilename = gtk_icon_info_get_filename(diskiconinfo);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3711
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3712
	diskbasepixbuf = gdk_pixbuf_new_from_file(diskfilename, NULL);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3713
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3714
	diskwidth = gdk_pixbuf_get_width(diskbasepixbuf);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3715
	diskheight = gdk_pixbuf_get_height(diskbasepixbuf);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3716
	switch (status) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3717
		case DISK_STATUS_OK:
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3718
		case DISK_STATUS_CANT_PRESERVE:
233
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3719
			/*
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3720
			 * If disk is too big, mark icon with warning tag
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3721
			 */
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3722
			if (disk_is_too_big(diskinfo)) {
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3723
				emblemiconinfo =
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3724
				    gtk_icon_theme_lookup_icon(icontheme,
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3725
				    "dialog-warning",
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3726
				    16,
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3727
				    0);
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3728
			}
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3729
			break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3730
		case DISK_STATUS_TOO_SMALL:
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3731
			emblemiconinfo =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3732
			    gtk_icon_theme_lookup_icon(icontheme,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3733
			    "dialog-error",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3734
			    16,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3735
			    0);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3736
			break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3737
		case DISK_STATUS_WARNING:
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3738
		case DISK_STATUS_LARGE_WARNING:
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3739
			emblemiconinfo =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3740
			    gtk_icon_theme_lookup_icon(icontheme,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3741
			    "dialog-warning",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3742
			    16,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3743
			    0);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3744
			break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3745
		default:
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3746
			break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3747
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3748
	if (emblemiconinfo != NULL) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3749
		emblemfilename = gtk_icon_info_get_filename(emblemiconinfo);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3750
		emblempixbuf = gdk_pixbuf_new_from_file(emblemfilename, NULL);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3751
		emblemwidth = gdk_pixbuf_get_width(emblempixbuf);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3752
		emblemheight = gdk_pixbuf_get_height(emblempixbuf);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3753
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3754
		gdk_pixbuf_composite(emblempixbuf,
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3755
		    diskbasepixbuf,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3756
		    diskwidth - emblemwidth,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3757
		    diskheight - emblemheight,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3758
		    emblemwidth,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3759
		    emblemheight,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3760
		    diskwidth - emblemwidth,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3761
		    diskheight - emblemheight,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3762
		    1,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3763
		    1,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3764
		    GDK_INTERP_BILINEAR,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3765
		    255);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3766
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3767
	diskbaseimage = gtk_image_new_from_pixbuf(diskbasepixbuf);
50
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3768
	g_object_unref(G_OBJECT(diskbasepixbuf));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3769
	gtk_widget_show(diskbaseimage);
50
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3770
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3771
	return (diskbaseimage);
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3772
}
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3773
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3774
/* Set the image */
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3775
static void
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3776
set_diskbutton_icon(GtkWidget *button, GtkWidget *image)
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3777
{
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3778
	GtkWidget *vbox;
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3779
	GtkWidget *oldimage;
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3780
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3781
	vbox = g_object_get_data(G_OBJECT(button),
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3782
	    "iconvbox");
50
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3783
	oldimage = g_object_get_data(G_OBJECT(button),
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3784
	    "icon");
50
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3785
	if (oldimage != NULL)
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3786
		gtk_widget_destroy(oldimage);
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3787
	gtk_box_pack_start(GTK_BOX(vbox), image, TRUE, TRUE, 0);
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3788
	g_object_set_data(G_OBJECT(button),
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3789
	    "icon",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3790
	    (gpointer)image);
50
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3791
}
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3792
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3793
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3794
/*
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3795
 * Create iconic radio buttons for the viewport scrollable area
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3796
 */
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3797
static GtkWidget *
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3798
disk_toggle_button_new_with_label(const gchar *label,
233
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  3799
	DiskStatus status, disk_info_t *diskinfo)
50
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3800
{
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3801
	GtkRadioButton *button;
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3802
	GtkWidget *alignment;
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3803
	GtkWidget *vbox;
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3804
	GtkWidget *buttonlabel;
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3805
	GtkWidget *diskbaseimage;
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3806
	gint diskwidth, diskheight;
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3807
	gint emblemwidth, emblemheight;
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3808
	static GtkRadioButton *firstbutton = NULL;
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3809
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3810
	if (!firstbutton) {
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3811
		button = GTK_RADIO_BUTTON(gtk_radio_button_new(NULL));
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3812
		firstbutton = button;
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3813
	} else
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3814
		button = GTK_RADIO_BUTTON(
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3815
		    gtk_radio_button_new_from_widget(firstbutton));
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3816
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3817
	/* Don't draw the check box indicator of the normal radiobutton */
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3818
	g_object_set(G_OBJECT(button),
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3819
	    "draw-indicator", FALSE,
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3820
	    NULL);
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3821
	gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3822
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3823
	alignment = gtk_alignment_new(0.5, 0.5, 0, 0);
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3824
	gtk_widget_show(alignment);
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3825
	gtk_container_add(GTK_CONTAINER(button), alignment);
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3826
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3827
	vbox = gtk_vbox_new(FALSE, 0);
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3828
	gtk_widget_show(vbox);
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3829
	gtk_container_add(GTK_CONTAINER(alignment), vbox);
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3830
	g_object_set_data(G_OBJECT(button),
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3831
	    "iconvbox",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3832
	    (gpointer)vbox);
50
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3833
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3834
	set_diskbutton_icon(GTK_WIDGET(button),
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3835
	    create_diskbutton_icon(status, diskinfo));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3836
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3837
	buttonlabel = gtk_label_new(label);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3838
	gtk_widget_show(buttonlabel);
50
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  3839
	gtk_box_pack_end(GTK_BOX(vbox), buttonlabel, FALSE, FALSE, 0);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3840
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3841
	return (GTK_WIDGET(button));
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3842
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3843
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3844
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3845
render_partitiontype_name(GtkCellLayout *layout,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3846
	GtkCellRenderer *cell,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3847
	GtkTreeModel *model,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3848
	GtkTreeIter *iter,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3849
	gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3850
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3851
	gchar *text = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3852
	gtk_tree_model_get(model, iter, 0, &text, -1);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3853
	if (!text)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3854
		return;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3855
	g_object_set(cell, "text", text, NULL);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3856
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  3857
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3858
gchar *
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3859
installationdisk_parttype_to_string(partition_info_t *partinfo)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3860
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3861
	gchar *type;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3862
	gint parttype = orchestrator_om_get_partition_type(partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3863
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3864
	switch (parttype) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3865
		case UNIXOS:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3866
			type = Ustr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3867
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3868
		case SUNIXOS:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3869
			if (partinfo->content_type == OM_CTYPE_LINUXSWAP)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3870
				type = LINUXstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3871
			else
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3872
				type = SUstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3873
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3874
		case SUNIXOS2:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3875
			type = SU2str;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3876
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3877
		case X86BOOT:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3878
			type = X86str;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3879
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3880
		case DOSOS12:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3881
			type = Dstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3882
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3883
		case DOSOS16:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3884
			type = D16str;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3885
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3886
		case EXTDOS:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3887
			type = EDstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3888
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3889
		case DOSDATA:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3890
			type = DDstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3891
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3892
		case DOSHUGE:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3893
			type = DBstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3894
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3895
		case PCIXOS:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3896
			type = PCstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3897
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3898
		case DIAGPART:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3899
			type = DIAGstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3900
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3901
		case FDISK_IFS:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3902
			type = IFSstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3903
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3904
		case FDISK_AIXBOOT:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3905
			type = AIXstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3906
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3907
		case FDISK_AIXDATA:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3908
			type = AIXDstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3909
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3910
		case FDISK_OS2BOOT:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3911
			type = OS2str;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3912
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3913
		case FDISK_WINDOWS:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3914
			type = WINstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3915
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3916
		case FDISK_EXT_WIN:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3917
			type = EWINstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3918
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3919
		case FDISK_FAT95:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3920
			type = FAT95str;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3921
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3922
		case FDISK_EXTLBA:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3923
			type = EXTLstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3924
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3925
		case FDISK_LINUX:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3926
			type = LINUXstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3927
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3928
		case FDISK_CPM:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3929
			type = CPMstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3930
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3931
		case FDISK_NOVELL2:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3932
			type = NOV2str;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3933
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3934
		case FDISK_NOVELL3:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3935
			type = NOVstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3936
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3937
		case FDISK_QNX4:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3938
			type = QNXstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3939
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3940
		case FDISK_QNX42:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3941
			type = QNX2str;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3942
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3943
		case FDISK_QNX43:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3944
			type = QNX3str;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3945
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3946
		case FDISK_LINUXNAT:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3947
			type = LINNATstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3948
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3949
		case FDISK_NTFSVOL1:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3950
			type = NTFSVOL1str;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3951
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3952
		case FDISK_NTFSVOL2:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3953
			type = NTFSVOL2str;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3954
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3955
		case FDISK_BSD:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3956
			type = BSDstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3957
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3958
		case FDISK_NEXTSTEP:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3959
			type = NEXTSTEPstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3960
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3961
		case FDISK_BSDIFS:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3962
			type = BSDIFSstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3963
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3964
		case FDISK_BSDISWAP:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3965
			type = BSDISWAPstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3966
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3967
		case EFI_PMBR:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3968
		case EFI_FS:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3969
			type = EFIstr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3970
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3971
		case OTHEROS:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3972
			type = Ostr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3973
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3974
		default:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3975
			type = _("Unknown");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3976
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3977
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3978
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3979
	return (type);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3980
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3981
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3982
static gfloat
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3983
calculate_avail_space(DiskBlockOrder *startblkorder,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3984
	gint partindex,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3985
	partition_info_t *partinfo)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3986
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3987
	DiskBlockOrder *curblkorder = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3988
	gfloat retavail = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3989
	gint parttype = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3990
	gfloat space_above = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3991
	gfloat space_below = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3992
	gfloat part_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3993
	gboolean break_on_next_unused = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3994
	GtkComboBox *combo;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3995
	int comboindex = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3996
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3997
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3998
	 * If partition_id does not exist in blkorder, then unused and
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  3999
	 * not displayed so therefore zero size avail
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4000
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4001
	if (installationdisk_blkorder_get_by_partition_id(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4002
	    startblkorder, partinfo->partition_id) == NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4003
		return (0);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4004
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4005
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4006
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4007
	 * if partindex != -1, function called from combo change signal
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4008
	 * handler, in this scenario we use the comboindex to determine
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4009
	 * partition type instead of the linked stored value.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4010
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4011
	if (partindex != -1) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4012
		/* Get values for combobox, spinner and avail */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4013
		combo = GTK_COMBO_BOX(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4014
		    MainWindow.InstallationDiskWindow.partcombo[partindex]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4015
		comboindex = gtk_combo_box_get_active(combo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4016
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4017
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4018
	for (curblkorder = startblkorder;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4019
	    curblkorder != NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4020
	    curblkorder = curblkorder->next) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4021
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4022
		g_debug("A : %d  - %f - %f - %f - %f - %f",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4023
		    curblkorder->partinfo.partition_id,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4024
		    orchestrator_om_round_mbtogb(partinfo->partition_size),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4025
		    orchestrator_om_round_mbtogb(curblkorder->partinfo.partition_size),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4026
		    space_above,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4027
		    part_size,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4028
		    space_below);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4029
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4030
		if (partindex != -1) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4031
			if (curblkorder->partinfo.partition_id == partinfo->partition_id) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4032
				/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4033
				 * Called by combobox change signal so type is new combobox
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4034
				 * Type not yet stored in this linked list.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4035
				 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4036
				switch (comboindex) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4037
					case SOLARIS_PARTITION :
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4038
						parttype = SUNIXOS2;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4039
						break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4040
					case EXTENDED_PARTITION :
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4041
						parttype = EXTDOS;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4042
						break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4043
					default :
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4044
						parttype = UNUSED;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4045
						break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4046
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4047
			} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4048
				parttype =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4049
				    orchestrator_om_get_partition_type(&curblkorder->partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4050
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4051
		} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4052
			parttype =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4053
			    orchestrator_om_get_partition_type(&curblkorder->partinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4054
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4055
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4056
		/* Now process as per normal */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4057
		if (parttype == UNUSED) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4058
			if (curblkorder->partinfo.partition_id == partinfo->partition_id) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4059
				part_size =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4060
				    orchestrator_om_round_mbtogb(partinfo->partition_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4061
				break_on_next_unused = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4062
			} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4063
				/* Unused block and not current so accumulate available space */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4064
				if (break_on_next_unused == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4065
					space_below += orchestrator_om_round_mbtogb(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4066
					    curblkorder->partinfo.partition_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4067
				} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4068
					space_above += orchestrator_om_round_mbtogb(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4069
					    curblkorder->partinfo.partition_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4070
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4071
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4072
		} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4073
			if (break_on_next_unused == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4074
				/* Break out now as reached either end of disk or next used */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4075
				break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4076
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4077
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4078
			if (curblkorder->partinfo.partition_id == partinfo->partition_id) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4079
				part_size =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4080
				    orchestrator_om_round_mbtogb(partinfo->partition_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4081
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4082
				/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4083
				 * If EXTENDED or Solaris partition then we want to continue
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4084
				 * And calculate free space below it
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4085
				 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4086
				if (IS_EXT_PAR(parttype) ||
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4087
				    IS_SOLARIS_PAR(parttype, partinfo->content_type)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4088
					break_on_next_unused = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4089
				} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4090
					/* Non Solaris so therefore no extra free space to show */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4091
					space_above = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4092
					space_below = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4093
					break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4094
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4095
			} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4096
				/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4097
				 * We've hit a partition thats not the one we want and it's
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4098
				 * also not free so reset the space_above to 0
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4099
				 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4100
				space_above = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4101
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4102
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4103
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4104
		g_debug("B : %d  - %f - %f - %f - %f - %f",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4105
		    curblkorder->partinfo.partition_id,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4106
		    orchestrator_om_round_mbtogb(partinfo->partition_size),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4107
		    orchestrator_om_round_mbtogb(curblkorder->partinfo.partition_size),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4108
		    space_above,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4109
		    part_size,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4110
		    space_below);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4111
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4112
	retavail = space_above + part_size + space_below;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4113
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4114
	g_debug("Calc space avail : %d : %f (%f + %f + %f)",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4115
	    partinfo->partition_id, retavail, space_above,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4116
	    part_size, space_below);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4117
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4118
	return (retavail);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4119
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4120
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4121
static gfloat
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4122
get_extended_partition_min_size(disk_parts_t *partitions)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4123
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4124
	gint lidx = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4125
	gfloat ret_size = 0.0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4126
	gfloat unused_to_remove = 0.0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4127
	partition_info_t *logpartinfo;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4128
	gint parttype;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4129
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4130
	/* Scan through logicals getting their total size */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4131
	for (lidx = FD_NUMPART; lidx < OM_NUMPART; lidx++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4132
		logpartinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4133
		    orchestrator_om_get_part_by_blkorder(partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4134
		    lidx);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4135
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4136
		if (logpartinfo) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4137
			parttype = orchestrator_om_get_partition_type(logpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4138
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4139
			if (parttype == UNUSED) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4140
				unused_to_remove += ONE_DECIMAL(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4141
				    orchestrator_om_get_partition_sizegb(logpartinfo));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4142
			} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4143
				ret_size += ONE_DECIMAL(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4144
				    orchestrator_om_get_partition_sizegb(logpartinfo));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4145
				if (unused_to_remove > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4146
					ret_size += unused_to_remove;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4147
					unused_to_remove = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4148
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4149
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4150
		} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4151
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4152
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4153
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4154
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4155
	/* Minimum size to be returned is 0.1 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4156
	if (ret_size <= 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4157
		ret_size = 0.1;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4158
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4159
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4160
	return (ret_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4161
}
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4162
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4163
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4164
disk_partitioning_set_from_parts_data(disk_info_t *diskinfo,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4165
	disk_parts_t *partitions)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4166
{
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4167
	partition_info_t *primpartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4168
	partition_info_t *logpartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4169
	LogicalPartition *logicalpart;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4170
	GtkComboBox *primcombo, *logcombo;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4171
	GtkSpinButton *primspinner, *logspinner;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4172
	GtkLabel *primavail, *logavail;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4173
	gchar *primtypestr, *logtypestr;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4174
	gint logpartindex, primpartindex;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4175
	gint primparttype, logparttype;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4176
	gdouble spinvalue = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4177
	gfloat avail_space = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4178
	gfloat from_val = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4179
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4180
	/* Initialize GUI back to default */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4181
	reset_primary_partitions(FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4182
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4183
	print_from_parts(TRUE, NULL, 0, NULL, 0, NULL, 0);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4184
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4185
	for (primpartindex = 0; primpartindex < FD_NUMPART; primpartindex++) {
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4186
		partition_info_t *origprimpartinfo = NULL;
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4187
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4188
		/* Should always return a valid partinfo struct */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4189
		primpartinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4190
		    orchestrator_om_get_part_by_blkorder(partitions, primpartindex);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4191
		g_assert(primpartinfo != NULL);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4192
715
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  4193
		/*
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  4194
		 * Attempt to get original equivalent as partitions may contain
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  4195
		 * partinfo's for unsued spaces the partition_order will differ
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  4196
		 * from the original partinfo array returned during target discovery
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  4197
		 * To get original equivalent we must use partition_id
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  4198
		 */
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4199
		origprimpartinfo =
715
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  4200
		    orchestrator_om_get_part_by_partition_id(
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4201
		    originalpartitions[activedisk],
715
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  4202
		    primpartinfo->partition_id);
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4203
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4204
		/* Set partition type of each fdisk partition in the comboboxes. */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4205
		primcombo = GTK_COMBO_BOX
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4206
		    (MainWindow.InstallationDiskWindow.partcombo[primpartindex]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4207
		primspinner = GTK_SPIN_BUTTON
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4208
		    (MainWindow.InstallationDiskWindow.partspin[primpartindex]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4209
		primavail = GTK_LABEL
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4210
		    (MainWindow.InstallationDiskWindow.partavail[primpartindex]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4211
		primparttype = orchestrator_om_get_partition_type(primpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4212
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4213
		primtypestr = installationdisk_parttype_to_string(primpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4214
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4215
		/*
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4216
		 * Check for changes in the paritition type from original, if
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4217
		 * so flag it as a warning.
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4218
		 */
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4219
		if (origprimpartinfo != NULL &&
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4220
		    primparttype !=
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4221
		    orchestrator_om_get_partition_type(origprimpartinfo)) {
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4222
			MainWindow.InstallationDiskWindow.
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4223
			    parttypechanges[primpartindex] = TRUE;
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4224
		}
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4225
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4226
		if (primparttype == UNUSED) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4227
			gtk_combo_box_set_active(primcombo, UNUSED_PARTITION);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4228
			MainWindow.InstallationDiskWindow.partcombosaved[primpartindex] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4229
			    UNUSED_PARTITION;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4230
		} else if (IS_SOLARIS_PAR(primparttype, primpartinfo->content_type)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4231
			gtk_combo_box_set_active(primcombo, SOLARIS_PARTITION);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4232
			MainWindow.InstallationDiskWindow.partcombosaved[primpartindex] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4233
			    SOLARIS_PARTITION;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4234
			/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4235
			 * Solaris partitions will always be erased because
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4236
			 * that's what we install onto, and we don't permit
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4237
			 * more than one solaris partition per disk. Solaris
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4238
			 * partitions can also be created/resized so they
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4239
			 * shouldn't be set to Unused:0.0GB like others.
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4240
			 * So always set it's size change flag to TRUE
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4241
			 */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4242
			if (activediskisreadable == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4243
				MainWindow.InstallationDiskWindow.partsizechanges[primpartindex] = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4244
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4245
		} else if (IS_EXT_PAR(primparttype)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4246
			/* Extended Partition */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4247
			gtk_combo_box_set_active(primcombo, EXTENDED_PARTITION);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4248
			MainWindow.InstallationDiskWindow.partcombosaved[primpartindex] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4249
			    EXTENDED_PARTITION;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4250
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4251
			/*
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4252
			 * Check for changes in the paritition type from
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4253
			 * original, if so flag it as a warning.
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4254
			 */
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4255
			if (origprimpartinfo != NULL &&
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4256
			    primpartinfo->partition_size !=
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4257
			    orchestrator_om_get_partition_sizemb(
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4258
			    origprimpartinfo)) {
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4259
				MainWindow.InstallationDiskWindow.
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4260
				    partsizechanges[primpartindex] = TRUE;
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4261
			}
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4262
			/*
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4263
			 * Now we need to check for logical disks, and if there are any
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4264
			 * Dynamically create intended widgets to display these
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4265
			 * As only one extended partition allowed per disk, logical disks
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4266
			 * start at position 4 (id==5) in pinfo struct
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4267
			 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4268
			for (logpartindex = FD_NUMPART;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4269
			    logpartindex < OM_NUMPART;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4270
			    logpartindex++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4271
				logpartinfo =
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4272
				    orchestrator_om_get_part_by_blkorder(
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4273
				    partitions,
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4274
				    logpartindex);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4275
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4276
				/* Logical partition found so display */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4277
				if (logpartinfo) {
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4278
					partition_info_t *origlogpartinfo = NULL;
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4279
715
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  4280
					/*
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  4281
					 * Attempt to get original equivalent as partitions may
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  4282
					 * contain partinfo's for unsued spaces the partition_order
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  4283
					 * will differ from the original partinfo array returned
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  4284
					 * during target discovery. To get original equivalent we
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  4285
					 * must use partition_id
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  4286
					 */
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4287
					origlogpartinfo =
715
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  4288
					    orchestrator_om_get_part_by_partition_id(
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4289
					    originalpartitions[activedisk],
715
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  4290
					    logpartinfo->partition_id);
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4291
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4292
					/* Create new logical widgets for this logical partition */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4293
					logicalpart = create_logical_partition_ui(primpartindex,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4294
					    logpartindex, TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4295
					logicalpart->logpartindex = logpartindex;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4296
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4297
					logcombo = GTK_COMBO_BOX(logicalpart->typecombo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4298
					logspinner = GTK_SPIN_BUTTON(logicalpart->sizespinner);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4299
					logavail = GTK_LABEL(logicalpart->availlabel);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4300
					logparttype =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4301
					    orchestrator_om_get_partition_type(logpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4302
					logtypestr =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4303
					    installationdisk_parttype_to_string(logpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4304
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4305
					if (origlogpartinfo != NULL) {
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4306
						if (logparttype !=
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4307
						    orchestrator_om_get_partition_type(
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4308
						    origlogpartinfo)) {
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4309
							logicalpart->typechange = TRUE;
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4310
						}
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4311
					}
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4312
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4313
					if (logparttype == UNUSED) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4314
						gtk_combo_box_set_active(logcombo, UNUSED_PARTITION);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4315
						logicalpart->partcombosaved = UNUSED_PARTITION;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4316
					} else if (IS_SOLARIS_PAR(logparttype,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4317
					    logpartinfo->content_type)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4318
						gtk_combo_box_set_active(logcombo, SOLARIS_PARTITION);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4319
						logicalpart->partcombosaved = SOLARIS_PARTITION;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4320
						/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4321
						 * Solaris partitions will always be erased because
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4322
						 * that's what we install onto, and we don't permit
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4323
						 * more than one solaris partition per disk. Solaris
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4324
						 * partitions can also be created/resized so they
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4325
						 * shouldn't be set to Unused:0.0GB like others.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4326
						 * So always set it's size change flag to TRUE
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4327
						 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4328
						if (activediskisreadable == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4329
							logicalpart->sizechange = TRUE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4330
						}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4331
					} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4332
						gtk_combo_box_append_text(logcombo, logtypestr);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4333
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4334
						/* Using EXTENDED_PARTITION just as enum reference */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4335
						gtk_combo_box_set_active(logcombo, EXTENDED_PARTITION);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4336
						logicalpart->partcombosaved = EXTENDED_PARTITION;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4337
						g_object_set_data(G_OBJECT(logcombo),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4338
						    "extra_fs",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4339
						    GINT_TO_POINTER(TRUE));
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4340
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4341
						/*
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4342
						 * Check for changes in the paritition type from original, if
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4343
						 * so flag it as a warning.
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4344
						 */
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4345
						if (origlogpartinfo != NULL) {
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4346
							if (logpartinfo->partition_size !=
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4347
							    orchestrator_om_get_partition_sizemb(origlogpartinfo)) {
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4348
								logicalpart->sizechange = TRUE;
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4349
							}
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4350
						}
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4351
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4352
					}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4353
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4354
					/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4355
					 * Get free space either side of this logical partition
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4356
					 * For logical partitions this is only pertinent for
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4357
					 * Solaris partitions
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4358
					 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4359
					avail_space = calculate_avail_space(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4360
					    modifiedlogicalblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4361
					    -1, logpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4362
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4363
					set_range_avail_from_value(logspinner, logavail,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4364
					    logparttype == UNUSED ? 0 : 0.1, avail_space);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4365
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4366
					set_size_widgets_from_value(logspinner, NULL,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4367
					    orchestrator_om_get_partition_sizegb(logpartinfo));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4368
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4369
					print_from_parts(FALSE, "Logical", logpartindex,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4370
					    logpartinfo,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4371
					    orchestrator_om_get_partition_sizegb(logpartinfo),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4372
					    logspinner, avail_space);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4373
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4374
					/* For now, these types are all we support */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4375
					if (IS_SOLARIS_PAR(logparttype, logpartinfo->content_type))
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4376
						gtk_widget_set_sensitive(GTK_WIDGET(logspinner), TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4377
					else
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4378
						gtk_widget_set_sensitive(GTK_WIDGET(logspinner), FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4379
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4380
					/* Set the avail space column */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4381
				} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4382
					/* Reached end of logicals so break out of loop */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4383
					break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4384
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4385
			}
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4386
		} else {
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4387
			/* Append exact partition type to combo and set this as active */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4388
			gtk_combo_box_append_text(primcombo, primtypestr);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4389
			gtk_combo_box_set_active(primcombo, NUM_DEFAULT_PARTITIONS);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4390
			MainWindow.InstallationDiskWindow.partcombosaved[primpartindex] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4391
			    NUM_DEFAULT_PARTITIONS;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4392
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4393
			/* Add extra_fs data object */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4394
			g_object_set_data(G_OBJECT(primcombo),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4395
			    "extra_fs",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4396
			    GINT_TO_POINTER(TRUE));
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4397
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4398
			/*
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4399
			 * Check for changes in the paritition type from
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4400
			 * original, if so flag it as a warning.
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4401
			 */
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4402
			if (origprimpartinfo != NULL &&
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4403
			    primpartinfo->partition_size !=
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4404
			    orchestrator_om_get_partition_sizemb(origprimpartinfo)) {
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4405
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4406
				MainWindow.InstallationDiskWindow.
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4407
				    partsizechanges[primpartindex] = TRUE;
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4408
			}
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4409
		}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4410
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4411
		/*
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4412
		 * Set the partition size of each partition
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4413
		 *
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4414
		 * This pre-rounding is necessary because the spin button will
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4415
		 * round the value before inserting it into the display and
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4416
		 * ocassionally cause the insert_text filter to spit it out
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4417
		 */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4418
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4419
		/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4420
		 * Calculate free space either side of this particular partition
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4421
		 * This is only really pertinent if the current partition is a
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4422
		 * Solaris partition or an extended partition.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4423
		 * Other partitions and UNUSED partitions cannot be resized
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4424
		 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4425
		avail_space = calculate_avail_space(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4426
		    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4427
		    -1, primpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4428
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4429
		if (IS_EXT_PAR(primparttype)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4430
			/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4431
			 * For extended partitions the lowest value we can
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4432
			 * spin down to is the lowest size of it's containing
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4433
			 * logicals minus any unused space at the end.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4434
			 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4435
			set_range_avail_from_value(primspinner, primavail,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4436
			    get_extended_partition_min_size(partitions),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4437
			    avail_space);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4438
		} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4439
			set_range_avail_from_value(primspinner, primavail,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4440
			    primparttype == UNUSED ? 0 : 0.1,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4441
			    avail_space);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4442
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4443
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4444
		set_size_widgets_from_value(primspinner, NULL,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4445
		    orchestrator_om_get_partition_sizegb(primpartinfo));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4446
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4447
		print_from_parts(FALSE, "Primary", primpartindex, primpartinfo,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4448
		    orchestrator_om_round_mbtogb(primpartinfo->partition_size),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4449
		    primspinner, avail_space);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4450
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4451
		/* For now, these types are all we support */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4452
		if (IS_SOLARIS_PAR(primparttype, primpartinfo->content_type)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4453
			gtk_widget_set_sensitive(GTK_WIDGET(primcombo), TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4454
			gtk_widget_set_sensitive(GTK_WIDGET(primspinner), TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4455
		} else if (IS_EXT_PAR(primparttype)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4456
			gtk_widget_set_sensitive(GTK_WIDGET(primcombo), TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4457
			gtk_widget_set_sensitive(GTK_WIDGET(primspinner), TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4458
		} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4459
			gtk_widget_set_sensitive(GTK_WIDGET(primspinner), FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4460
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4461
			/* Check if avail/actual size > 0 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4462
			if (avail_space <= 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4463
				gtk_widget_set_sensitive(GTK_WIDGET(primcombo), FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4464
			} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4465
				gtk_widget_set_sensitive(GTK_WIDGET(primcombo), TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4466
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4467
		}
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4468
	}
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4469
	update_data_loss_warnings();
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4470
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4471
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4472
/* Get Maximum width of a GtkCellRender */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4473
static gint
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4474
get_max_cell_renderer_width(void)
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4475
{
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4476
	GtkListStore *partitiontype_store;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4477
	gint x, y, width, height;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4478
	gint cur_max_width = 0, cur_max_height = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4479
	gint active_combo = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4480
	GtkWidget *dummy_combo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4481
	GtkCellRenderer *dummy_renderer = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4482
	GtkTreeIter iter;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4483
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4484
	/* Create combo box */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4485
	dummy_combo = gtk_combo_box_new();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4486
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4487
	/* Initialize dummy_combo */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4488
	partitiontype_store = gtk_list_store_new(1, G_TYPE_STRING);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4489
	gtk_list_store_append(partitiontype_store, &iter);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4490
	gtk_list_store_set(partitiontype_store, &iter, 0, _(Unused), -1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4491
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4492
	gtk_combo_box_set_model(GTK_COMBO_BOX(dummy_combo),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4493
	    GTK_TREE_MODEL(partitiontype_store));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4494
	dummy_renderer = gtk_cell_renderer_text_new();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4495
	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(dummy_combo),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4496
	    dummy_renderer,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4497
	    TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4498
	gtk_cell_layout_set_cell_data_func(GTK_CELL_LAYOUT(dummy_combo),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4499
	    dummy_renderer,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4500
	    render_partitiontype_name,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4501
	    NULL,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4502
	    NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4503
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4504
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4505
	 * To get width, we need to attach item to parent so that combobox
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4506
	 * gets realized, but not displayed
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4507
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4508
	gtk_table_attach(GTK_TABLE(MainWindow.InstallationDiskWindow.fdisktable),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4509
	    dummy_combo,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4510
	    0,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4511
	    1,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4512
	    MainWindow.InstallationDiskWindow.fdisktablerows-1,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4513
	    MainWindow.InstallationDiskWindow.fdisktablerows,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4514
	    GTK_FILL,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4515
	    0,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4516
	    0,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4517
	    0);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4518
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4519
	/* Set to longest type string "NOVstr", and get size */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4520
	g_object_set(dummy_renderer, "text", NOVstr, NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4521
	gtk_cell_renderer_get_size(dummy_renderer, GTK_WIDGET(dummy_combo), NULL,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4522
	    &x, &y, &width, &height);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4523
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4524
	gtk_widget_destroy(dummy_combo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4525
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4526
	return (width);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4527
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4528
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4529
/* Populates the comboboxes with the supported fdisk partition types */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4530
static void
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4531
disk_combobox_ui_init(GtkComboBox *combobox,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4532
	gboolean is_primary)
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4533
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4534
	GtkCellRenderer *renderer;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4535
	GtkListStore *partitiontype_store;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4536
	GtkTreeIter iter;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4537
	gint x, y, width, height;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4538
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4539
	partitiontype_store = gtk_list_store_new(1, G_TYPE_STRING);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4540
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4541
	/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4542
	 * The only valid partition *selectable* types are Unused & Solaris
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4543
	 * Everything else is is non selectable.
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4544
	 * Addendum, EXTENDED is selectable now.
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4545
	 */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4546
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4547
	gtk_list_store_append(partitiontype_store, &iter);
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4548
	gtk_list_store_set(partitiontype_store, &iter, 0, _(Unused), -1);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4549
	gtk_list_store_append(partitiontype_store, &iter);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4550
	gtk_list_store_set(partitiontype_store, &iter, 0, SU2str, -1);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4551
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4552
	if (is_primary == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4553
		gtk_list_store_append(partitiontype_store, &iter);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4554
		gtk_list_store_set(partitiontype_store, &iter, 0, _(Extended), -1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4555
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4556
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4557
	gtk_combo_box_set_model(GTK_COMBO_BOX(combobox),
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4558
	    GTK_TREE_MODEL(partitiontype_store));
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4559
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4560
	renderer = gtk_cell_renderer_text_new();
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4561
	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(combobox), renderer,  TRUE);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4562
	gtk_cell_layout_set_cell_data_func(GTK_CELL_LAYOUT(combobox),
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4563
	    renderer,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4564
	    render_partitiontype_name,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4565
	    NULL,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4566
	    NULL);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4567
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4568
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4569
	 * Following code sets the max width of the cell within the combobox
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4570
	 * Doing For largest type string "NOVstr", ensures combobox does not
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4571
	 * Grow/Shrink in width when user selects different partition types
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4572
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4573
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4574
	if (max_combo_width == 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4575
		max_combo_width = get_max_cell_renderer_width();
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4576
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4577
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4578
	if (is_primary == FALSE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4579
		gtk_cell_renderer_set_fixed_size(renderer, max_combo_width, -1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4580
	} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4581
		gtk_cell_renderer_set_fixed_size(renderer,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4582
		    max_combo_width+LOGICAL_COMBOBOX_INDENT, -1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4583
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4584
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4585
	gtk_combo_box_set_active(GTK_COMBO_BOX(combobox), UNUSED_PARTITION);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4586
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4587
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4588
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4589
disk_comboboxes_ui_init(void)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4590
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4591
	gint i;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4592
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4593
	for (i = 0; i < FD_NUMPART; i++) {
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4594
		disk_combobox_ui_init(GTK_COMBO_BOX
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4595
		    (MainWindow.InstallationDiskWindow.partcombo[i]),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4596
		    TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4597
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4598
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4599
/* Reset the comboboxes with the supported fdisk partition types */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4600
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4601
disk_combobox_ui_reset(GtkComboBox *combobox,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4602
	gboolean is_primary)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4603
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4604
	GtkTreeModel *combomodel;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4605
	gint n_children = 0, i = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4606
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4607
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4608
	 * Check of combobox already has a gtk_list_store
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4609
	 * If it does, Reset items to the default list of items
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4610
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4611
	combomodel = gtk_combo_box_get_model(GTK_COMBO_BOX(combobox));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4612
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4613
	if (combomodel != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4614
		n_children = gtk_tree_model_iter_n_children(combomodel, NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4615
		for (i = n_children; i >= 0; i--) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4616
			gtk_combo_box_remove_text(GTK_COMBO_BOX(combobox), i);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4617
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4618
		gtk_combo_box_append_text(GTK_COMBO_BOX(combobox), _(Unused));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4619
		gtk_combo_box_append_text(GTK_COMBO_BOX(combobox), SU2str);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4620
		if (is_primary == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4621
			gtk_combo_box_append_text(GTK_COMBO_BOX(combobox), _(Extended));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4622
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4623
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4624
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4625
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4626
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4627
disk_comboboxes_ui_reset(void)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4628
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4629
	gint i;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4630
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4631
	for (i = 0; i < FD_NUMPART; i++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4632
		disk_combobox_ui_reset(GTK_COMBO_BOX
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4633
		    (MainWindow.InstallationDiskWindow.partcombo[i]),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4634
		    TRUE);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4635
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4636
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4637
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4638
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4639
init_disk_status(void)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4640
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4641
	disk_parts_t *partitions;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4642
	disk_info_t *diskinfo = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4643
	DiskStatus *status = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4644
	gint i = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4645
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4646
	g_return_if_fail(alldiskstatus != NULL);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4647
	g_return_if_fail(numdisks > 0);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4648
	for (i = 0; i < numdisks; i++) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4649
		diskinfo = alldiskinfo[i];
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4650
		status = &alldiskstatus[i];
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4651
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4652
		if (diskinfo == NULL) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4653
			g_warning("%d disks were detected but no information about disk "
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4654
			    "%d was found", numdisks, i);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4655
			*status = DISK_STATUS_NO_DISKINFO;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4656
			continue;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4657
		}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4658
		if (orchestrator_om_get_disk_sizemb(diskinfo) == 0) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4659
			*status = DISK_STATUS_NO_MEDIA;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4660
			continue;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4661
		}
233
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  4662
		if (orchestrator_om_get_disk_sizegb(diskinfo) <
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  4663
		    orchestrator_om_get_mininstall_sizegb(FALSE)) {
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  4664
			g_warning("%s disk has %.1fGB (is too small)",
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  4665
			    diskinfo->disk_name,
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  4666
			    orchestrator_om_get_disk_sizegb(diskinfo));
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  4667
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4668
			*status = DISK_STATUS_TOO_SMALL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4669
			continue;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4670
		}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4671
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4672
		if (diskinfo->label != OM_LABEL_VTOC &&
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4673
		    diskinfo->label != OM_LABEL_FDISK) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4674
			*status = DISK_STATUS_CANT_PRESERVE;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4675
			continue;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4676
		}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4677
#if defined(__i386)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4678
		partitions = orchestrator_om_get_disk_partitions(omhandle,
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4679
		    diskinfo->disk_name);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4680
		if (!partitions) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4681
			g_message("Can't find disks partitions on device: %s",
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4682
			    diskinfo->disk_name);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4683
			*status = DISK_STATUS_CANT_PRESERVE;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4684
			continue;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4685
		}
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4686
		om_free_disk_partition_info(omhandle, partitions);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4687
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4688
		*status = DISK_STATUS_OK;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4689
#else /* (__sparc) */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4690
		/* On SPARC, the disk always gets wiped */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4691
		*status = DISK_STATUS_CANT_PRESERVE;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4692
#endif /* (__i386) */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4693
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4694
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4695
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4696
static DiskStatus
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4697
get_disk_status(guint disknum)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4698
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4699
	g_return_val_if_fail(disknum < numdisks, -1);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4700
	g_return_val_if_fail(alldiskstatus != NULL, -1);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4701
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4702
	return (alldiskstatus[disknum]);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4703
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4704
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4705
/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4706
 * Called when target discovery is complete and we're ready to query
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4707
 * the orchestrator for disk info
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4708
 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4709
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4710
populate_data_from_orchestrator_discovery(void)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4711
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4712
	gint i = 0, j = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4713
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4714
	alldiskinfo = orchestrator_om_get_disk_info(omhandle, &numdisks);
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  4715
587
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  4716
	g_return_if_fail(numdisks > 0);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4717
	alldiskstatus = g_new0(DiskStatus, numdisks);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4718
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4719
	originalpartitions = g_new0(disk_parts_t *, numdisks);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4720
	modifiedpartitions = g_new0(disk_parts_t *, numdisks);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4721
	proposedpartitions = g_new0(disk_parts_t *, numdisks);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4722
	defaultpartitions  = g_new0(disk_parts_t *, numdisks);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4723
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4724
	originalprimaryblkorder = g_new0(DiskBlockOrder *, numdisks);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4725
	originallogicalblkorder = g_new0(DiskBlockOrder *, numdisks);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4726
	modifiedprimaryblkorder = g_new0(DiskBlockOrder *, numdisks);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4727
	modifiedlogicalblkorder = g_new0(DiskBlockOrder *, numdisks);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4728
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4729
	init_disk_status();
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4730
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4731
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4732
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4733
disk_viewport_diskbuttons_init(GtkViewport *viewport)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4734
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4735
	gchar **disklabels;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4736
	gchar *disktiptext;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4737
	GtkTooltips *disktip;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4738
	int disknum;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4739
	DiskStatus status;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4740
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4741
	/* Create the hbutton box first */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4742
	hbuttonbox = gtk_hbutton_box_new();
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4743
	g_signal_connect(G_OBJECT(icontheme), "changed",
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4744
	    G_CALLBACK(icon_theme_changed),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4745
	    (gpointer) hbuttonbox);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4746
50
44e2e51a8f98 826 Theme switching in installer GUI is broken
niall@localhost
parents: 37
diff changeset
  4747
	gtk_button_box_set_spacing(hbuttonbox, 36);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4748
	gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox),
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4749
	    GTK_BUTTONBOX_START);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4750
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4751
	diskbuttons = g_new0(GtkWidget *, numdisks);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4752
	disklabels = g_new0(gchar *, numdisks);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4753
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4754
	for (disknum = 0; disknum < numdisks; disknum++) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4755
		status = get_disk_status(disknum);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4756
		if (status == DISK_STATUS_NO_DISKINFO) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4757
			g_warning("Skipping over installation target disk %d: "
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4758
			    "no disk info provided.",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4759
			    disknum);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4760
			continue;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4761
		}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4762
		disklabels[disknum] = disk_viewport_create_disk_label(disknum);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4763
		disktip = gtk_tooltips_new();
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4764
		disktiptext = disk_viewport_create_disk_tiptext(disknum);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4765
		diskbuttons[disknum] =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4766
		    disk_toggle_button_new_with_label(disklabels[disknum],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4767
		    status, alldiskinfo[disknum]);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4768
		gtk_tooltips_set_tip(disktip, diskbuttons[disknum], disktiptext, NULL);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4769
		g_free(disklabels[disknum]);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4770
		g_free(disktiptext);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4771
		gtk_widget_show(diskbuttons[disknum]);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4772
		gtk_box_pack_start(GTK_BOX(hbuttonbox),
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4773
		    diskbuttons[disknum],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4774
		    FALSE,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4775
		    FALSE,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4776
		    0);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4777
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4778
		g_signal_connect(G_OBJECT(diskbuttons[disknum]),
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4779
		    "toggled",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4780
		    G_CALLBACK(installationdisk_diskbutton_toggled),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4781
		    GINT_TO_POINTER(disknum));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4782
		g_signal_connect(G_OBJECT(diskbuttons[disknum]),
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4783
		    "focus",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4784
		    G_CALLBACK(installationdisk_diskbutton_focused),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4785
		    GINT_TO_POINTER(disknum));
500
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4786
		g_signal_connect(G_OBJECT(diskbuttons[disknum]),
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4787
		    "focus-in-event",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4788
		    G_CALLBACK(disk_partitioning_button_focus_handler),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4789
		    GINT_TO_POINTER(disknum));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4790
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4791
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4792
	g_free(disklabels);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4793
	gtk_widget_show(hbuttonbox);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4794
	gtk_container_add(GTK_CONTAINER(viewport), hbuttonbox);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4795
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4796
500
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4797
/*
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4798
 * Return the index of the default disk
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4799
 * or -1 indicating an error.
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4800
 * The default disk should be the 1st
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4801
 * bootable disk, or the 1st usable disk,
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4802
 * or the 1st available disk.
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4803
 */
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4804
static gint
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4805
get_default_disk_index(void)
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4806
{
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4807
	gint chosendisk = -1;
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4808
	gint i = 0;
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4809
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4810
	for (i = 0; i < numdisks; i++) {
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4811
		if (get_disk_status(i) == DISK_STATUS_OK ||
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4812
		    get_disk_status(i) == DISK_STATUS_CANT_PRESERVE) {
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4813
			if (orchestrator_om_disk_is_bootdevice(alldiskinfo[i])) {
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4814
				/*
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4815
				 * If boot device is found
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4816
				 * and it's usable, look no further.
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4817
				 */
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4818
				chosendisk = i;
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4819
				break;
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4820
			} else if (chosendisk < 0)
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4821
				/*
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4822
				 * fall back to the 1st
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4823
				 * usable disk
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4824
				 */
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4825
				chosendisk = i;
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4826
		}
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4827
	}
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4828
	/* fall back to the 1st avaiable disk */
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4829
	if (numdisks > 0 && chosendisk < 0)
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4830
		chosendisk = 0;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4831
	return (chosendisk);
500
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4832
}
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4833
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4834
static gboolean
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4835
partition_discovery_monitor(gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4836
{
587
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  4837
	gchar *markup;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4838
	gboolean bootdevfound = FALSE;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4839
	gint chosendisk = -1;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4840
	gint i = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4841
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4842
	/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4843
	 * Don't to anything until both target discovery and
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4844
	 * UI initialisation has been completed
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4845
	 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4846
	if (MainWindow.MileStoneComplete[OM_UPGRADE_TARGET_DISCOVERY] == FALSE)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4847
		return (TRUE);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4848
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4849
	GtkViewport *viewport;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4850
	viewport = GTK_VIEWPORT(MainWindow.InstallationDiskWindow.disksviewport);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4851
	populate_data_from_orchestrator_discovery();
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4852
	if (scanningbox) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4853
		gtk_widget_destroy(scanningbox);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4854
	}
587
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  4855
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  4856
	if (numdisks == 0) {
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  4857
		/* Display Info that no disks were found */
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  4858
		markup = g_strdup_printf("<span font_desc=\"Bold\">%s</span>",
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  4859
		    _("No disks were found."));
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  4860
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  4861
		gtk_label_set_markup(GTK_LABEL
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  4862
		    (MainWindow.InstallationDiskWindow.diskstatuslabel),
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  4863
		    markup);
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  4864
		g_free(markup);
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  4865
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  4866
		gtk_widget_show(MainWindow.InstallationDiskWindow.diskerrorimage);
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  4867
		gtk_widget_show(MainWindow.InstallationDiskWindow.diskstatuslabel);
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  4868
	}
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  4869
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4870
	disk_viewport_diskbuttons_init(viewport);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4871
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4872
	/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4873
	 * Auto select the boot disk, or failing that, the first suitable disk
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4874
	 * and toggle the custom partitioning controls.
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4875
	 */
500
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4876
	chosendisk = get_default_disk_index();
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4877
	if (chosendisk >= 0) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4878
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4879
		    diskbuttons[chosendisk]),
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4880
		    TRUE);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4881
		/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4882
		 * It's safe to call this on SPARC also since the callback
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4883
		 * is a no-op.
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4884
		 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4885
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4886
		    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4887
		    "partitiondiskradio")),
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4888
		    TRUE);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4889
		/* Force a toggle emission */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4890
		gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4891
		    diskbuttons[chosendisk]));
500
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4892
		if (GTK_WIDGET_VISIBLE(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4893
		    MainWindow.InstallationDiskWindow.diskselectiontoplevel))
500
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  4894
			gtk_widget_grab_focus(diskbuttons[chosendisk]);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4895
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4896
#if defined(__i386)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4897
		/* Show partitioning options on X86 only */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4898
		gtk_widget_show(glade_xml_get_widget(
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4899
		    MainWindow.installationdiskwindowxml,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4900
		    "partitioningvbox"));
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4901
#endif
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4902
	}
392
ddb3f64c2dc5 3796 Focus remaining on the "Next" button rather than going to the first thing in the panel that appears after you press "Next"
jedy@pampas
parents: 386
diff changeset
  4903
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4904
	return (FALSE);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4905
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4906
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4907
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4908
disk_viewport_ui_init(GtkViewport *viewport)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4909
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4910
	GtkWidget *busyimage;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4911
	GtkWidget *label;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4912
	gchar *markup;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4913
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4914
	/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4915
	 * XXX: Doesn't use image from the icon theme. Switch this to a stock
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4916
	 * animation in future releases when A11Y and theme support become a
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4917
	 * requirement.
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4918
	 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4919
	if (MainWindow.MileStoneComplete[OM_UPGRADE_TARGET_DISCOVERY] == FALSE) {
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4920
		markup = g_strdup_printf("<span font_desc=\"Bold\">%s</span>",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4921
		    _("Finding Disks"));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4922
		label = gtk_label_new(NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4923
		gtk_label_set_markup(GTK_LABEL(label), markup);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4924
		g_free(markup);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4925
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4926
		busyimage = gtk_image_new_from_file(PIXMAPDIR "/" "gnome-spinner.gif");
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4927
		gtk_widget_show(busyimage);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4928
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4929
		scanningbox = gtk_vbox_new(FALSE, 0);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4930
		gtk_box_pack_start(GTK_BOX(scanningbox), label, FALSE, FALSE, 0);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4931
		gtk_box_pack_end(GTK_BOX(scanningbox), busyimage, FALSE, FALSE, 0);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4932
		gtk_widget_show(label);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4933
		gtk_widget_show(busyimage);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4934
		gtk_widget_show(scanningbox);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4935
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4936
		gtk_container_add(GTK_CONTAINER(viewport), scanningbox);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4937
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4938
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4939
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4940
static gchar*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4941
disk_viewport_create_disk_tiptext(guint disknum)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4942
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4943
	/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4944
	 * Tooltip consists of:
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4945
	 *  Size: <size>
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4946
	 *  Type: <usb|scsi|etc.>
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4947
	 *  Vendor: <vendor>
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4948
	 *  Devicename: <cXtXdX>
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4949
	 *  Bootdisk <Y/N>
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4950
	 *  <instance 1>
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4951
	 *  <instance 2>
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4952
	 *  <...>
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4953
	 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4954
	disk_info_t *diskinfo;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4955
	upgrade_info_t *uinfos = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4956
	upgrade_info_t *uinfo = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4957
	guint16 ninstance;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4958
	gfloat size;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4959
	gchar *type;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4960
	const gchar *vendor;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4961
	gboolean isbootdisk;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4962
	const gchar *devicename;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4963
	gchar *newtiptext;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4964
	gchar *instancetext;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4965
	gchar *tiptext;
233
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  4966
	gchar *units = "GB";
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4967
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4968
	diskinfo = alldiskinfo[disknum];
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4969
	orchestrator_om_get_upgrade_targets_by_disk(diskinfo,
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4970
	    &uinfos, &ninstance);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4971
233
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  4972
	size = orchestrator_om_get_total_disk_sizegb(diskinfo);
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  4973
	/* if disk is bigger than 1TB, display disk size in TB */
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  4974
	if (size > GBPERTB) {
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  4975
		size /= GBPERTB;
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  4976
		units = "TB";
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  4977
	}
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  4978
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4979
	type = orchestrator_om_get_disk_type(diskinfo);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4980
	vendor = orchestrator_om_get_disk_vendor(diskinfo);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4981
	devicename = orchestrator_om_get_disk_devicename(diskinfo);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4982
	isbootdisk = orchestrator_om_disk_is_bootdevice(diskinfo);
233
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  4983
	tiptext = g_strdup_printf(_("Size: %.1f%s\n"
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4984
	    "Type: %s\n"
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4985
	    "Vendor: %s\n"
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4986
	    "Device: %s\n"
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4987
	    "Boot device: %s"),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4988
	    size,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4989
	    units,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4990
	    type,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4991
	    vendor,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4992
	    devicename,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4993
	    isbootdisk ? _("Yes") : _("No"));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4994
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4995
	uinfo = uinfos;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4996
	while (uinfo) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4997
		instancetext =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  4998
		    orchestrator_om_upgrade_instance_get_release_name(uinfo);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  4999
		if (instancetext) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5000
			newtiptext = g_strconcat(tiptext, _("\n"),
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5001
			    instancetext, NULL);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5002
			g_free(tiptext);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5003
			tiptext = newtiptext;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5004
		}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5005
		uinfo = orchestrator_om_upgrade_instance_get_next(uinfo);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5006
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5007
	g_free(type);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5008
	return (tiptext);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5009
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5010
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5011
static gchar*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5012
disk_viewport_create_disk_label(guint disknum)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5013
{
233
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  5014
	/* Label consists of: "<sizeinGB|TB>[GB|TB] <disktype> */
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  5015
	gfloat disksize = 0;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5016
	gchar *disktype  = NULL;
233
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  5017
	gchar *disksizeunits = "GB";
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5018
	gchar *label = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5019
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5020
	disktype = orchestrator_om_get_disk_type(alldiskinfo[disknum]);
233
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  5021
	disksize = orchestrator_om_get_total_disk_sizegb(alldiskinfo[disknum]);
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  5022
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  5023
	/* if disk is bigger than 1TB, display disk size in TB */
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  5024
	if (disksize > GBPERTB) {
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  5025
		disksize /= GBPERTB;
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  5026
		disksizeunits = "TB";
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  5027
	}
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  5028
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  5029
	label = g_strdup_printf("%.1f%s %s", disksize, disksizeunits, disktype);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5030
	g_free(disktype);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5031
	return (label);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5032
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5033
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5034
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5035
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5036
disk_partitioning_block_all_handlers(void)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5037
{
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5038
	gint i = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5039
	LogicalPartition *curlogical = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5040
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5041
	gint mask = (1<<0 | 1<<1 | 1<<2 | 1<<3);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5042
	disk_partitioning_block_spinbox_handlers(mask);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5043
	disk_partitioning_block_combobox_handlers(mask);
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5044
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5045
	for (i = 0; i < FD_NUMPART; i++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5046
		if (MainWindow.InstallationDiskWindow.startlogical[i] != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5047
			for (curlogical = MainWindow.InstallationDiskWindow.startlogical[i];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5048
			    curlogical != NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5049
			    curlogical = curlogical->next) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5050
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5051
				/* Block spinner and combobox handler for logical partition */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5052
				if (curlogical->combochangehandler > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5053
					g_signal_handler_block(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5054
					    (gpointer *)curlogical->typecombo,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5055
					    curlogical->combochangehandler);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5056
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5057
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5058
				if (curlogical->spinnerchangehandler > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5059
					g_signal_handler_block(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5060
					    (gpointer *)curlogical->sizespinner,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5061
					    curlogical->spinnerchangehandler);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5062
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5063
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5064
				if (curlogical->spinnerinserthandler > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5065
					g_signal_handler_block(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5066
					    (gpointer *)curlogical->sizespinner,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5067
					    curlogical->spinnerinserthandler);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5068
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5069
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5070
				if (curlogical->spinnerdeletehandler > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5071
					g_signal_handler_block(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5072
					    (gpointer *)curlogical->sizespinner,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5073
					    curlogical->spinnerdeletehandler);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5074
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5075
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5076
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5077
	}
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5078
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5079
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5080
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5081
disk_partitioning_unblock_all_handlers(void)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5082
{
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5083
	gint i = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5084
	LogicalPartition *curlogical = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5085
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5086
	gint mask = (1<<0 | 1<<1 | 1<<2 | 1<<3);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5087
	disk_partitioning_unblock_spinbox_handlers(mask);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5088
	disk_partitioning_unblock_combobox_handlers(mask);
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5089
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5090
	for (i = 0; i < FD_NUMPART; i++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5091
		if (MainWindow.InstallationDiskWindow.startlogical[i] != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5092
			for (curlogical = MainWindow.InstallationDiskWindow.startlogical[i];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5093
			    curlogical != NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5094
			    curlogical = curlogical->next) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5095
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5096
				/* Block spinner and combobox handler for logical partition */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5097
				if (curlogical->combochangehandler > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5098
					g_signal_handler_unblock(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5099
					    (gpointer *)curlogical->typecombo,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5100
					    curlogical->combochangehandler);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5101
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5102
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5103
				if (curlogical->spinnerchangehandler > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5104
					g_signal_handler_unblock(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5105
					    (gpointer *)curlogical->sizespinner,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5106
					    curlogical->spinnerchangehandler);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5107
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5108
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5109
				if (curlogical->spinnerinserthandler > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5110
					g_signal_handler_unblock(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5111
					    (gpointer *)curlogical->sizespinner,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5112
					    curlogical->spinnerinserthandler);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5113
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5114
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5115
				if (curlogical->spinnerinserthandler > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5116
					g_signal_handler_unblock(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5117
					    (gpointer *)curlogical->sizespinner,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5118
					    curlogical->spinnerdeletehandler);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5119
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5120
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5121
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5122
	}
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5123
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5124
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5125
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5126
disk_partitioning_block_spinbox_handlers(gint mask)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5127
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5128
	gint i = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5129
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5130
	if (mask == 0)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5131
		return;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5132
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5133
	for (i = 0; i < FD_NUMPART; i++) {
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5134
		if (mask & 1<<i) {
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5135
			if (spininserthandlers[i] > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5136
				g_signal_handler_block(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5137
				    (gpointer *)MainWindow.InstallationDiskWindow.partspin[i],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5138
				    spininserthandlers[i]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5139
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5140
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5141
			if (spindeletehandlers[i] > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5142
				g_signal_handler_block(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5143
				    (gpointer *)MainWindow.InstallationDiskWindow.partspin[i],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5144
				    spindeletehandlers[i]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5145
			}
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5146
		}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5147
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5148
	if (mask & 1<<0)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5149
		g_signal_handlers_block_by_func(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5150
		    (gpointer *)MainWindow.InstallationDiskWindow.partspin[0],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5151
		    (gpointer *)partition_0_spinner_value_changed,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5152
		    NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5153
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5154
	if (mask & 1<<1)
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5155
		g_signal_handlers_block_by_func(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5156
		    (gpointer *)MainWindow.InstallationDiskWindow.partspin[1],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5157
		    (gpointer *)partition_1_spinner_value_changed,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5158
		    NULL);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5159
	if (mask & 1<<2)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5160
		g_signal_handlers_block_by_func(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5161
		    (gpointer *)MainWindow.InstallationDiskWindow.partspin[2],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5162
		    (gpointer *)partition_2_spinner_value_changed,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5163
		    NULL);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5164
	if (mask & 1<<3)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5165
		g_signal_handlers_block_by_func(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5166
		    (gpointer *)MainWindow.InstallationDiskWindow.partspin[3],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5167
		    (gpointer *)partition_3_spinner_value_changed,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5168
		    NULL);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5169
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5170
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5171
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5172
disk_partitioning_unblock_spinbox_handlers(gint mask)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5173
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5174
	gint i  = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5175
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5176
	if (mask == 0)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5177
		return;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5178
	for (i = 0; i < FD_NUMPART; i++) {
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5179
		if (mask & 1<<i) {
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5180
			if (spininserthandlers[i] > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5181
				g_signal_handler_unblock(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5182
				    (gpointer *)MainWindow.InstallationDiskWindow.partspin[i],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5183
				    spininserthandlers[i]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5184
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5185
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5186
			if (spindeletehandlers[i] > 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5187
				g_signal_handler_unblock(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5188
				    (gpointer *)MainWindow.InstallationDiskWindow.partspin[i],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5189
				    spindeletehandlers[i]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5190
			}
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5191
		}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5192
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5193
	if (mask & 1<<0)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5194
		g_signal_handlers_unblock_by_func(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5195
		    (gpointer *)MainWindow.InstallationDiskWindow.partspin[0],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5196
		    (gpointer *)partition_0_spinner_value_changed,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5197
		    NULL);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5198
	if (mask & 1<<1)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5199
		g_signal_handlers_unblock_by_func(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5200
		    (gpointer *)MainWindow.InstallationDiskWindow.partspin[1],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5201
		    (gpointer *)partition_1_spinner_value_changed,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5202
		    NULL);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5203
	if (mask & 1<<2)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5204
		g_signal_handlers_unblock_by_func(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5205
		    (gpointer *)MainWindow.InstallationDiskWindow.partspin[2],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5206
		    (gpointer *)partition_2_spinner_value_changed,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5207
		    NULL);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5208
	if (mask & 1<<3)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5209
		g_signal_handlers_unblock_by_func(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5210
		    (gpointer *)MainWindow.InstallationDiskWindow.partspin[3],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5211
		    (gpointer *)partition_3_spinner_value_changed,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5212
		    NULL);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5213
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5214
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5215
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5216
disk_partitioning_block_combobox_handlers(gint mask)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5217
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5218
	if (mask == 0)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5219
		return;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5220
	if (mask & 1<<0)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5221
		g_signal_handlers_block_by_func(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5222
		    (gpointer *)MainWindow.InstallationDiskWindow.partcombo[0],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5223
		    (gpointer *)partition_0_combo_changed,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5224
		    NULL);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5225
	if (mask & 1<<1)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5226
		g_signal_handlers_block_by_func(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5227
		    (gpointer *)MainWindow.InstallationDiskWindow.partcombo[1],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5228
		    (gpointer *)partition_1_combo_changed,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5229
		    NULL);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5230
	if (mask & 1<<2)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5231
		g_signal_handlers_block_by_func(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5232
		    (gpointer *)MainWindow.InstallationDiskWindow.partcombo[2],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5233
		    (gpointer *)partition_2_combo_changed,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5234
		    NULL);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5235
	if (mask & 1<<3)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5236
		g_signal_handlers_block_by_func(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5237
		    (gpointer *)MainWindow.InstallationDiskWindow.partcombo[3],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5238
		    (gpointer *)partition_3_combo_changed,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5239
		    NULL);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5240
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5241
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5242
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5243
disk_partitioning_unblock_combobox_handlers(gint mask)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5244
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5245
	if (mask == 0)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5246
		return;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5247
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5248
	if (mask & 1<<0)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5249
		g_signal_handlers_unblock_by_func(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5250
		    (gpointer *)MainWindow.InstallationDiskWindow.partcombo[0],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5251
		    (gpointer *)partition_0_combo_changed,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5252
		    NULL);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5253
	if (mask & 1<<1)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5254
		g_signal_handlers_unblock_by_func(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5255
		    (gpointer *)MainWindow.InstallationDiskWindow.partcombo[1],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5256
		    (gpointer *)partition_1_combo_changed,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5257
		    NULL);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5258
	if (mask & 1<<2)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5259
		g_signal_handlers_unblock_by_func(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5260
		    (gpointer *)MainWindow.InstallationDiskWindow.partcombo[2],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5261
		    (gpointer *)partition_2_combo_changed,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5262
		    NULL);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5263
	if (mask & 1<<3)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5264
		g_signal_handlers_unblock_by_func(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5265
		    (gpointer *)MainWindow.InstallationDiskWindow.partcombo[3],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5266
		    (gpointer *)partition_3_combo_changed,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5267
		    NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5268
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5269
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5270
static void disk_partitioning_block_combox_handler(guint partindex)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5271
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5272
	/* Convenience function to block an individual combox handler */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5273
	gint mask = 1<<partindex;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5274
	disk_partitioning_block_combobox_handlers(mask);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5275
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5276
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5277
static void disk_partitioning_unblock_combox_handler(guint partindex)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5278
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5279
	/* Convenience function to unblock an individual combox handler */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5280
	gint mask = 1<<partindex;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5281
	disk_partitioning_unblock_combobox_handlers(mask);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5282
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5283
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5284
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5285
logical_spinners_insert_text_filter(GtkEntry *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5286
	const gchar *newtext,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5287
	gint length,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5288
	gint *position,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5289
	gpointer user_data)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5290
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5291
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5292
	 * Validation is the same for both logicals and primarys so simply
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5293
	 * call the already defined primary handler.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5294
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5295
	spinners_insert_text_filter(widget, newtext, length, position, user_data);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5296
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5297
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5298
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5299
spinners_insert_text_filter(GtkEntry *widget,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5300
	const gchar *newtext,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5301
	gint length,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5302
	gint *position,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5303
	gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5304
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5305
	const gchar *currenttext;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5306
	const gchar *textptr;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5307
	gchar *newnumstring = NULL;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5308
	gdouble newnum;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5309
	gdouble min, max;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5310
	gint newstrlen = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5311
	gint decimalplaces = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5312
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5313
	currenttext = gtk_entry_get_text(GTK_ENTRY(widget));
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5314
	gtk_spin_button_get_range(GTK_SPIN_BUTTON(widget), &min, &max);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5315
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5316
	/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5317
	 * Need to generate newnumstring based on insertion position
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5318
	 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5319
	newstrlen = strlen(currenttext) + length;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5320
	newnumstring = g_new0(gchar, newstrlen + 1);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5321
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5322
	strncat(newnumstring, currenttext, *position);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5323
	strncat(newnumstring, newtext, length);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5324
	if (*position < strlen(currenttext)) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5325
		textptr = &currenttext[*position];
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5326
		strcat(newnumstring, textptr);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5327
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5328
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5329
	/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5330
	 * Check to make sure there's no more than 1 decimal
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5331
	 * place in the new number. Note that the decimal place
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5332
	 * character literal is dependant on locale environment,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5333
	 * hence the use of "isdigit()" instead of checking for
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5334
	 * a "." or "," character.
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5335
	 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5336
	textptr = newnumstring;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5337
	while (*textptr != '\0') {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5338
		if (!isdigit(*textptr)) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5339
			decimalplaces = strlen(textptr+1);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5340
			break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5341
		}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5342
		textptr++;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5343
	}
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5344
	newnum = strtod(newnumstring, NULL);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5345
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5346
	if (newnum > max || decimalplaces > 1) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5347
		gdk_beep();
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5348
		g_signal_stop_emission_by_name(GTK_OBJECT(widget), "insert_text");
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5349
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5350
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5351
	g_free(newnumstring);
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5352
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5353
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5354
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5355
logical_spinners_delete_text_filter(GtkEditable *widget,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5356
	gint start_pos,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5357
	gint end_pos,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5358
	gpointer user_data)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5359
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5360
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5361
	 * Validation is the same for both logicals and primarys so simply
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5362
	 * call the already defined primary handler.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5363
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5364
	spinners_delete_text_filter(widget, start_pos, end_pos, user_data);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5365
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5366
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5367
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5368
spinners_delete_text_filter(GtkEditable *widget,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5369
	gint start_pos,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5370
	gint end_pos,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5371
	gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5372
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5373
	gchar *currenttext;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5374
	const gchar *str1 = NULL, *str2 = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5375
	gchar *newnumstring = NULL;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5376
	gdouble newnum;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5377
	gdouble min, max;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5378
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5379
	currenttext = g_strdup(gtk_entry_get_text(GTK_ENTRY(widget)));
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5380
	if (strtod(currenttext, NULL) == 0) {
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5381
		g_free(currenttext);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5382
		return;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5383
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5384
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5385
	gtk_spin_button_get_range(GTK_SPIN_BUTTON(widget), &min, &max);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5386
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5387
	/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5388
	 * Need to generate newstring based on deletion span
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5389
	 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5390
	str1 = currenttext;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5391
	currenttext[start_pos] = '\0';
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5392
	str2 = &currenttext[end_pos];
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5393
	newnumstring = g_strdup_printf("%s%s", str1, str2);
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5394
	newnum = strtod(newnumstring, NULL);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5395
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5396
	if (newnum > max) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5397
		gdk_beep();
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5398
		g_signal_stop_emission_by_name(GTK_OBJECT(widget), "delete_text");
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5399
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5400
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5401
	g_free(currenttext);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5402
	g_free(newnumstring);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5403
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5404
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5405
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5406
disk_partitioning_set_sensitive(gboolean sensitive)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5407
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5408
	if (sensitive == FALSE) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5409
		/* Collapse the custom partitioning controls */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5410
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5411
		    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5412
		    "wholediskradio")),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5413
		    TRUE);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5414
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5415
	gtk_widget_set_sensitive(
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5416
	    glade_xml_get_widget(MainWindow.installationdiskwindowxml,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5417
	    "partitioningvbox"), sensitive);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5418
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5419
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5420
/* Makes the scrollbar and viewport adjust to follow the focussed button */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5421
static gboolean
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5422
disk_partitioning_button_focus_handler(GtkWidget *widget,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5423
	GdkEventFocus *event,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5424
	gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5425
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5426
	gint disknum = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5427
	gfloat newvalue = 0.0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5428
	gfloat buttonval = 0.0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5429
	gfloat buttonposition = 0.0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5430
	gdouble value, lower, upper, pagesize;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5431
	gfloat buttonsize;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5432
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5433
	disknum = GPOINTER_TO_INT(user_data);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5434
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5435
	g_object_get(G_OBJECT(viewportadjustment), "value", &value, NULL);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5436
	g_object_get(G_OBJECT(viewportadjustment), "lower", &lower, NULL);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5437
	g_object_get(G_OBJECT(viewportadjustment), "upper", &upper, NULL);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5438
	g_object_get(G_OBJECT(viewportadjustment), "page-size", &pagesize, NULL);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5439
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5440
	/* double precision is too expensive and overkill - use float */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5441
	buttonsize = (gfloat)((upper - lower)/numdisks);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5442
	buttonposition = (gfloat)disknum / numdisks;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5443
	buttonval = buttonposition * (gfloat)(upper - lower);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5444
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5445
	/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5446
	 * Increment scrolling adjustment just enough to keep
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5447
	 * the button visible in the viewport
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5448
	 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5449
	if (value+pagesize <= buttonval+buttonsize) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5450
		newvalue = buttonval + buttonsize - pagesize;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5451
		gtk_adjustment_set_value(viewportadjustment, (gdouble)newvalue);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5452
		gtk_adjustment_value_changed(viewportadjustment);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5453
	} else if (value >= buttonval) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5454
		newvalue = buttonval;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5455
		gtk_adjustment_set_value(viewportadjustment, (gdouble)newvalue);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5456
		gtk_adjustment_value_changed(viewportadjustment);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5457
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5458
	return (FALSE);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5459
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5460
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5461
/* Hides the scrollbar if scrolling is not necessary */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5462
static void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5463
viewport_adjustment_changed(GtkAdjustment *adjustment, gpointer user_data)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5464
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5465
	GtkWidget *scrollbar;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5466
	gdouble lower, upper, pagesize;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5467
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5468
	scrollbar = GTK_WIDGET(user_data);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5469
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5470
	g_object_get(G_OBJECT(adjustment), "lower", &lower, NULL);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5471
	g_object_get(G_OBJECT(adjustment), "upper", &upper, NULL);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5472
	g_object_get(G_OBJECT(adjustment), "page-size", &pagesize, NULL);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5473
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5474
	if ((upper - lower) <= pagesize)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5475
		gtk_widget_hide(scrollbar);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5476
	else
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5477
		gtk_widget_show(scrollbar);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5478
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5479
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5480
static gboolean
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5481
disk_partitions_match(disk_parts_t *old, disk_parts_t *new)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5482
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5483
	gboolean retval = TRUE;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5484
	partition_info_t *parta, *partb;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5485
	guint64 sizea = 0, sizeb = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5486
	gint i = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5487
	g_return_val_if_fail(old, FALSE);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5488
	g_return_val_if_fail(new, FALSE);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5489
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5490
	g_debug("Comparing partitioning requisition.....");
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5491
	for (i = 0; i < OM_NUMPART; i++) {
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5492
		parta = orchestrator_om_get_part_by_blkorder(old, i);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5493
		partb = orchestrator_om_get_part_by_blkorder(new, i);
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5494
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5495
		if (parta != NULL || partb != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5496
			sizea = orchestrator_om_get_partition_sizemb(parta);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5497
			sizeb = orchestrator_om_get_partition_sizemb(partb);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5498
			/* Ignore small differences due to rounding: <= 100MB */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5499
			if ((sizea - sizeb) > 100) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5500
				retval = FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5501
				g_warning("Partition %d sizes don't match:", i+1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5502
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5503
			g_debug("Part %d: Requested: %lld Received: %lld",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5504
			    i, sizea, sizeb);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5505
		}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5506
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5507
	return (retval);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5508
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5509
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5510
/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5511
 * Takes a list of paritions, and re-populates them from the
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5512
 * modifiedprimaryblkorder and modifiedlogicalblkorder linked lists.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5513
 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5514
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5515
restore_unused_partitions(guint disknum, disk_parts_t *partitions)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5516
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5517
	static void **last_restored = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5518
	guint i = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5519
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5520
	/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5521
	 * Remember the partitions pointer here so that we don't regenerate the
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5522
	 * black order more than once for the same list of partitions.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5523
	 *
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5524
	 * The Orchestrator always returns a new pointer, so if we see something
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5525
	 * new we will handle it, otherwise ignore it.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5526
	 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5527
	if (last_restored == NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5528
		/* First time, allocate the space for each known disk */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5529
		last_restored = g_new0(void*, numdisks);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5530
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5531
	if (((void*)partitions) == last_restored[disknum]) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5532
		g_debug("Not doing a restore on partitions, already done (%08X)",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5533
		    last_restored[disknum]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5534
		return;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5535
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5536
	last_restored[disknum] = (void*)partitions;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5537
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5538
	g_debug("Before attempting to restore partitioning on device %s:",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5539
	    partitions->disk_name ? partitions->disk_name : "NULL");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5540
	for (i = 0; i < OM_NUMPART; i++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5541
		g_debug("\tPartition %d: id: %d order: %d type: %d size: %d",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5542
		    i,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5543
		    (int)partitions->pinfo[i].partition_id,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5544
		    (int)partitions->pinfo[i].partition_order,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5545
		    partitions->pinfo[i].partition_type,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5546
		    partitions->pinfo[i].partition_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5547
	}
782
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5548
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5549
	print_partinfos(disknum, alldiskinfo, &partitions);
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5550
	print_blkorder(alldiskinfo[disknum],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5551
	    modifiedprimaryblkorder[disknum],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5552
	    modifiedlogicalblkorder[disknum]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5553
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5554
	/* Recalculate the disk's blockorder layout using new information */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5555
	installationdisk_get_blkorder_layout(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5556
	    alldiskinfo[disknum],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5557
	    partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5558
	    &modifiedprimaryblkorder[disknum],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5559
	    &modifiedlogicalblkorder[disknum]);
782
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5560
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5561
	g_debug("After recreating blkorder lists :");
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5562
	print_partinfos(disknum, alldiskinfo, &partitions);
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5563
	print_blkorder(alldiskinfo[disknum],
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5564
	    modifiedprimaryblkorder[disknum],
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5565
	    modifiedlogicalblkorder[disknum]);
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5566
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5567
	initialize_default_partition_layout(disknum);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5568
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5569
	/* Force a redraw of the widgets */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5570
	disk_selection_set_active_disk(disknum);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5571
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5572
	g_debug("After attempting to restore partitioning on device %s:",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5573
	    partitions->disk_name ? partitions->disk_name : "NULL");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5574
	for (i = 0; i < OM_NUMPART; i++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5575
		g_debug("\tPartition %d: id: %d order: %d type: %d size: %d",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5576
		    i,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5577
		    (int)partitions->pinfo[i].partition_id,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5578
		    (int)partitions->pinfo[i].partition_order,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5579
		    partitions->pinfo[i].partition_type,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5580
		    partitions->pinfo[i].partition_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5581
	}
782
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5582
	print_partinfos(disknum, alldiskinfo, &partitions);
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5583
	print_blkorder(alldiskinfo[disknum],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5584
	    modifiedprimaryblkorder[disknum],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5585
	    modifiedlogicalblkorder[disknum]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5586
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5587
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5588
static gboolean
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5589
installationdisk_partinfo_changed(partition_info_t *partinfo)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5590
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5591
	partition_info_t *origpartinfo;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5592
	disk_parts_t *partitions = originalpartitions[activedisk];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5593
	gint i = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5594
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5595
	/* Check if a given partition has changed in type or size */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5596
	for (i = 0; i < OM_NUMPART; i++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5597
		origpartinfo = &partitions->pinfo[i];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5598
		if (origpartinfo->partition_id == partinfo->partition_id) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5599
			if (origpartinfo->partition_size != partinfo->partition_size ||
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5600
			    origpartinfo->partition_type != partinfo->partition_type) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5601
				return (TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5602
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5603
			break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5604
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5605
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5606
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5607
	return (FALSE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5608
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5609
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5610
/*
715
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5611
 * Takes a list of partitons, which are usually sorted by partition_order
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5612
 * since that's how it's displayed in the GUI and do the following:
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5613
 *
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5614
 * - Primary partitions are re-ordered by partition_id to ensure they remain
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5615
 *   correctly layed out on the disk - i.e. an unchaged p3 remains as p3
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5616
 * - Logicals are first collapsed to remove gaps, but then sorted by
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5617
 *   partition_id (This is how fdisk logical partitions are handled by
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5618
 *   investigated OS-es).
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5619
 *
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5620
 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5621
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5622
collapse_partitions(disk_parts_t *partitions)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5623
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5624
	gint i = 0;
782
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5625
	gint j = 0;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5626
	gint part_order = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5627
	partition_info_t *partition = NULL;
782
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5628
	partition_info_t *tmppartition = NULL;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5629
	partition_info_t *unused_partition = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5630
	partition_info_t *origpartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5631
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5632
	g_debug("Before attempting to collapse partitioning on device %s:",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5633
	    partitions->disk_name ? partitions->disk_name : "NULL");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5634
	for (i = 0; i < OM_NUMPART; i++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5635
		g_debug("\tPartition %d: id: %d order: %d type: %d size: %d",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5636
		    i,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5637
		    (int)partitions->pinfo[i].partition_id,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5638
		    (int)partitions->pinfo[i].partition_order,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5639
		    partitions->pinfo[i].partition_type,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5640
		    partitions->pinfo[i].partition_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5641
	}
715
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5642
	/*
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5643
	 * First re-sort the 4 Primary partitions by partition_id.
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5644
	 *
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5645
	 * The assumption is that the partition_ids are always valid and correct,
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5646
	 * this should be maintained by code that allocates spaces to them.
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5647
	 */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5648
	for (i = 0; i < FD_NUMPART; i++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5649
		partition = &partitions->pinfo[i];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5650
		if (partition) {
715
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5651
			if (partition->partition_type == UNUSED) {
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5652
				/* Unused space */
782
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5653
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5654
				/* Reduce partition_order for all other partitions */
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5655
				for (j = 0; j < FD_NUMPART; j++) {
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5656
					if (tmppartition = &partitions->pinfo[j]) {
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5657
						if (tmppartition->partition_order >
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5658
						    partition->partition_order) {
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5659
							tmppartition->partition_order -= 1;
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5660
						}
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5661
					}
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5662
				}
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5663
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5664
				/* Zeroize all array elements for UNUSED */
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5665
				partition->partition_id = 0;
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5666
				partition->partition_order = 0;
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5667
				partition->partition_type = UNUSED;
715
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5668
				partition->partition_size = 0;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5669
				partition->partition_offset = 0;
782
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5670
				partition->partition_size_sec = 0;
715
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5671
				partition->partition_offset_sec = 0;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5672
			}
715
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5673
			/* Skip a zeroed partition_id */
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5674
			g_debug("Checking: %d != %d", (partition->partition_id - 1), i);
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5675
			if (partition->partition_id > 0 &&
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5676
			    (partition->partition_id - 1) != i) {
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5677
				/*
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5678
				 * If not in equivalent position in the array
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5679
				 * then Swap it with whatever is ocupying it's
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5680
				 * space.
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5681
				 */
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5682
				partition_info_t    temp_partition = {0};
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5683
				partition_info_t   *correct_partition =
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5684
				    &partitions->pinfo[partition->partition_id - 1];
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5685
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5686
				g_debug("Moving p%d (%d) to p%d(%d)",
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5687
				    i,
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5688
				    partition->partition_id,
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5689
				    partition->partition_id - 1,
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5690
				    correct_partition->partition_id);
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5691
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5692
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5693
				/* Copy out what's already there */
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5694
				(void) memcpy(&temp_partition, correct_partition,
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5695
				    sizeof (partition_info_t));
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5696
				/* Fill it with the correct partition id */
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5697
				(void) memcpy(correct_partition, partition,
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5698
				    sizeof (partition_info_t));
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5699
				/* Put old partition id, where we are now */
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5700
				(void) memcpy(partition, &temp_partition,
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5701
				    sizeof (partition_info_t));
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5702
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5703
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5704
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5705
715
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5706
	/* First collapse the logical paritions, removing gaps in partition_order */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5707
	unused_partition = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5708
	part_order = 4;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5709
	for (i = FD_NUMPART; i < OM_NUMPART; i++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5710
		partition = &partitions->pinfo[i];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5711
		if (partition) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5712
			/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5713
			 * If a partitions type or size has changed then we
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5714
			 * zeroize offset values as they are meaningless we
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5715
			 * do this to ensure the orchestrator's validation
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5716
			 * function does not attempt to use these values.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5717
			 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5718
			if (installationdisk_partinfo_changed(partition)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5719
				partition->partition_offset = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5720
				partition->partition_size_sec = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5721
				partition->partition_offset_sec = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5722
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5723
			if (partition->partition_type != UNUSED) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5724
				if (unused_partition) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5725
					/* Move to unused space (swap) */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5726
					partition_info_t temp_partition = {0};
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5727
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5728
					partition->partition_order = ++part_order;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5729
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5730
					(void) memcpy(&temp_partition, unused_partition,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5731
					    sizeof (partition_info_t));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5732
					(void) memcpy(unused_partition, partition,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5733
					    sizeof (partition_info_t));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5734
					(void) memcpy(partition, &temp_partition,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5735
					    sizeof (partition_info_t));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5736
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5737
					unused_partition = partition;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5738
				} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5739
					partition->partition_order =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5740
					    ++part_order;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5741
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5742
			} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5743
				/* Unused space */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5744
				if (unused_partition == NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5745
					/* move next allocated primary to here */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5746
					unused_partition = partition;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5747
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5748
				/* Enusre unused size is 0 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5749
				partition->partition_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5750
				partition->partition_id = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5751
				partition->partition_order = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5752
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5753
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5754
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5755
715
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5756
	/*
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5757
	 * Now re-sort the logical partitions by partition_id. This is required to
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5758
	 * ensure that they are orders as in the original layout.
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5759
	 */
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5760
	for (i = FD_NUMPART; i < OM_NUMPART; i++) {
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5761
		partition = &partitions->pinfo[i];
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5762
		if (partition) {
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5763
			/* Skip a zeroed partition_id */
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5764
			if (partition->partition_id != 0 &&
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5765
			    partition->partition_id != (i+1)) {
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5766
				/*
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5767
				 * If not in equivalent position in the array then
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5768
				 * Swap it with whatever is ocupying it's space
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5769
				 */
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5770
				partition_info_t    temp_partition = {0};
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5771
				partition_info_t   *other_partition =
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5772
				    &partitions->pinfo[partition->partition_id - 1];
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5773
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5774
				(void) memcpy(&temp_partition, other_partition,
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5775
				    sizeof (partition_info_t));
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5776
				(void) memcpy(other_partition, partition,
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5777
				    sizeof (partition_info_t));
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5778
				(void) memcpy(partition, &temp_partition,
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5779
				    sizeof (partition_info_t));
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5780
			}
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5781
		}
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5782
	}
8c995fff963e Fix 13993 - GUI installer does not maintain partition number ordering
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 702
diff changeset
  5783
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5784
	g_debug("After attempting to collapse partitioning on device %s:",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5785
	    partitions->disk_name ? partitions->disk_name : "NULL");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5786
	for (i = 0; i < OM_NUMPART; i++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5787
		g_debug("\tPartition %d: id: %d order: %d type: %d size: %d",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5788
		    i,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5789
		    (int)partitions->pinfo[i].partition_id,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5790
		    (int)partitions->pinfo[i].partition_order,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5791
		    partitions->pinfo[i].partition_type,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5792
		    partitions->pinfo[i].partition_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5793
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5794
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5795
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5796
gboolean
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5797
installationdisk_validate()
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5798
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5799
	disk_parts_t *partitions = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5800
	disk_parts_t *newpartitions = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5801
	partition_info_t *partition = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5802
	gchar *errorprimarytext = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5803
	gchar *errorsecondarytext = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5804
	gchar *warningprimarytext = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5805
	gchar *warningsecondarytext = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5806
	gint i = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5807
	gint numpartitions = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5808
	gfloat solarispartitionsize = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5809
	gint64 freespace = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5810
	guint64 diskusage = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5811
	guint64 diskcapacity = 0;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5812
	guint64 extended_part_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5813
	guint64 logical_diskusage = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5814
	gint64 logical_freespace = 0;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5815
	gboolean partitionsmatch = FALSE;
588
40a31e921c17 1290 Malformed "Adjusted partition..." dialog
Matt <matt.keenan@sun.com>
parents: 587
diff changeset
  5816
	gboolean prompt_retval = FALSE;
702
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5817
	GtkToggleButton *usewholediskradio;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5818
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5819
	/* 1. No disk selected */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5820
	if (activedisk < 0) {
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5821
		errorprimarytext = g_strdup(
1398
3cd5b2156d4c imported patch oi-branding-cmd-gui-install
Alasdair Lumsden <al@everycity.co.uk>
parents: 872
diff changeset
  5822
		    _("No disk has been selected for OpenIndiana installation."));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5823
		errorsecondarytext =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5824
		    g_strdup(_("Select a disk."));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5825
		goto errors;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5826
	}
702
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5827
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5828
	/* 2. No suitable disk selected */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5829
	/* Only condition I can think of is disk too small */
702
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5830
	diskcapacity = orchestrator_om_get_disk_sizemb(alldiskinfo[activedisk]);
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5831
	if (diskcapacity < orchestrator_om_get_mininstall_sizemb()) {
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5832
		errorprimarytext = g_strdup(
1398
3cd5b2156d4c imported patch oi-branding-cmd-gui-install
Alasdair Lumsden <al@everycity.co.uk>
parents: 872
diff changeset
  5833
		    _("The selected disk is not suitable for OpenIndiana installation."));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5834
		errorsecondarytext =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5835
		    g_strdup(_("Select another disk."));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5836
		goto errors;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5837
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5838
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5839
/* Partitioning related errors are not applicable to SPARC - yet */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5840
#if defined(__i386)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5841
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5842
	g_assert(proposedpartitions != NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5843
	g_assert(proposedpartitions[activedisk] != NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5844
	partitions = proposedpartitions[activedisk];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5845
	/* 3. No Solaris partitions defined */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5846
	numpartitions =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5847
	    orchestrator_om_get_numparts_of_type(partitions, SUNIXOS2);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5848
	numpartitions +=
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5849
	    orchestrator_om_get_numparts_of_type(partitions, SUNIXOS);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5850
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5851
	for (i = 0; i < OM_NUMPART; i++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5852
		partition = &partitions->pinfo[i];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5853
		if (partition && partition->partition_type != UNUSED) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5854
			/* Only count if it's not partition_type Unused */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5855
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5856
			if (IS_EXT_PAR(partition->partition_type)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5857
				/* Remember size of extended partition if found */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5858
				extended_part_size =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5859
				    orchestrator_om_get_partition_sizemb(partition);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5860
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5861
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5862
			if (i < FD_NUMPART) { /* Primary partition */
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5863
				diskusage +=
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5864
				    orchestrator_om_get_partition_sizemb(partition);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5865
			} else { /* Locical parition */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5866
				logical_diskusage +=
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5867
				    orchestrator_om_get_partition_sizemb(partition);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5868
			}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5869
		}
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5870
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5871
	freespace = diskcapacity - diskusage;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5872
	logical_freespace = extended_part_size - logical_diskusage;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5873
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5874
	if (numpartitions == 0) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5875
		errorprimarytext =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5876
		    g_strdup(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5877
		    _("The selected disk contains no Solaris partitions."));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5878
		errorsecondarytext =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5879
		    g_strdup(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5880
		    _("Create one Solaris partition or use the whole disk."));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5881
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5882
		goto errors;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5883
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5884
	/* 4. Must be only one Solaris partition */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5885
	} else if (numpartitions > 1) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5886
		errorprimarytext =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5887
		    g_strdup(_("There must be only one Solaris partition."));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5888
		errorsecondarytext =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5889
		    g_strdup(_("Change the extra Solaris partitions to another type."));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5890
		goto errors;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5891
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5892
	/* 5. Disk space over allocated */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5893
	} else if ((freespace < -(MBPERGB / 10)) ||
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5894
	    (logical_freespace < -(MBPERGB / 10))) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5895
		errorprimarytext =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5896
		    g_strdup(_("The disk space has been over allocated."));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5897
		errorsecondarytext =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5898
		    g_strdup(_("Reduce the size of one or more partitions "
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5899
		    "until the available disk space is zero."));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5900
		goto errors;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5901
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5902
	/* 6. Check if the Solaris partition is too small */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5903
	/* Find the first Solaris partition, should be the only one at this stage */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5904
	for (i = 0; i < OM_NUMPART; i++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5905
		partition =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5906
		    orchestrator_om_get_part_by_blkorder(partitions, i);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5907
		if (IS_SOLARIS_PAR(orchestrator_om_get_partition_type(partition),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5908
		    partition->content_type)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5909
			solarispartitionsize =
782
06bc494dfb77 14929 liborchestrator hits assert during creation of new partition for installation
Matt Keenan <matt.keenan@sun.com>
parents: 715
diff changeset
  5910
			    ONE_DECIMAL(orchestrator_om_get_partition_sizegb(partition));
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5911
			break;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5912
		}
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5913
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5914
	if (solarispartitionsize <
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5915
	    orchestrator_om_get_mininstall_sizegb(FALSE)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5916
		errorprimarytext =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5917
		    g_strdup(_("The Solaris partition is too "
1398
3cd5b2156d4c imported patch oi-branding-cmd-gui-install
Alasdair Lumsden <al@everycity.co.uk>
parents: 872
diff changeset
  5918
		    "small for installation."));
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5919
		errorsecondarytext =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5920
		    g_strdup(_("Increase the size of the Solaris partition."));
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5921
	}
702
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5922
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5923
#endif /* (__i386) */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5924
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5925
errors:
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5926
	if (errorprimarytext != NULL) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5927
		gui_install_prompt_dialog(FALSE, FALSE, FALSE,
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5928
		    GTK_MESSAGE_ERROR,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5929
		    errorprimarytext,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5930
		    errorsecondarytext);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5931
		g_free(errorprimarytext);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5932
		g_free(errorsecondarytext);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5933
		return (FALSE);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5934
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5935
702
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5936
	/* Non fatal test for disk size < recommended */
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5937
	/* Only display this warning if entire disk is being used */
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5938
	usewholediskradio = GTK_TOGGLE_BUTTON
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5939
	    (glade_xml_get_widget(MainWindow.installationdiskwindowxml,
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5940
	    "wholediskradio"));
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5941
	if (gtk_toggle_button_get_active(usewholediskradio) == TRUE &&
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5942
	    diskcapacity >= orchestrator_om_get_mininstall_sizemb() &&
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5943
	    diskcapacity < orchestrator_om_get_recommended_sizemb()) {
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5944
		warningprimarytext = g_strdup(
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5945
		    _("The selected disk is smaller than the recommended "
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5946
		    "minimum size."));
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5947
		warningsecondarytext =
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5948
		    g_strdup(_("You may have difficulties upgrading the system "
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5949
		    "software and/or installing and running additional "
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5950
		    "applications."));
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5951
		goto warnings;
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5952
	}
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5953
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5954
/* Partitioning related errors are not applicable to SPARC - yet */
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5955
#if defined(__i386)
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5956
	/* Non fatal test for solaris partition size < recommended */
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5957
	/* Perform test regardless of using whole disk or not */
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5958
	if (solarispartitionsize >=
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5959
	    orchestrator_om_get_mininstall_sizegb(FALSE) &&
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5960
	    solarispartitionsize <
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5961
	    orchestrator_om_get_recommended_sizegb()) {
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5962
		warningprimarytext = g_strdup(
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5963
		    _("The selected partition is smaller than the recommended "
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5964
		    "minimum size."));
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5965
		warningsecondarytext =
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5966
		    g_strdup(_("You may have difficulties upgrading the "
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5967
		    "system software and/or installing and running "
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5968
		    "additional applications."));
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5969
		goto warnings;
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5970
	}
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5971
#endif
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5972
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5973
warnings:
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5974
	if (warningprimarytext != NULL) {
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5975
		prompt_retval = gui_install_prompt_dialog(TRUE, FALSE, FALSE,
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5976
		    GTK_MESSAGE_WARNING,
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5977
		    warningprimarytext,
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5978
		    warningsecondarytext);
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5979
		g_free(warningprimarytext);
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5980
		g_free(warningsecondarytext);
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5981
		warningprimarytext = NULL;
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5982
		warningsecondarytext = NULL;
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5983
		if (prompt_retval == FALSE) {
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5984
			return (FALSE);
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5985
		}
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5986
	}
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  5987
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5988
	/* Now check for non-fatal warning conditions */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5989
	/* For X86 - unallocated disk space */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5990
#if defined(__i386)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5991
	g_debug("Original partitioning on device %s:",
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5992
	    partitions->disk_name ? partitions->disk_name : "NULL");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5993
	for (i = 0; i < OM_NUMPART; i++) {
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5994
		g_debug("\tPartition %d: type: %d size: %d",
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  5995
		    i,
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5996
		    originalpartitions[activedisk]->pinfo[i].partition_type,
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5997
		    originalpartitions[activedisk]->pinfo[i].partition_size);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5998
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  5999
	g_debug("Attempting to set partitioning on device %s:",
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6000
	    partitions->disk_name ? partitions->disk_name : "NULL");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6001
	for (i = 0; i < OM_NUMPART; i++) {
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6002
		g_debug("\tPartition %d: type: %d size: %d",
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6003
		    i, partitions->pinfo[i].partition_type,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6004
		    partitions->pinfo[i].partition_size);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6005
	}
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6006
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6007
	collapse_partitions(partitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6008
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6009
	g_debug("Partinfos before om_validate");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6010
	print_partinfos(activedisk, alldiskinfo, modifiedpartitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6011
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6012
	newpartitions = om_validate_and_resize_disk_partitions(omhandle,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6013
	    partitions, GUI_allocation);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6014
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6015
	/* new partitions will be positioned automatically */
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6016
	if (newpartitions == NULL) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6017
		gchar *warningcode = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6018
		int16_t error;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6019
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6020
		g_warning("Orchestrator not happy with partitioning");
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6021
		error = om_get_error();
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6022
		switch (error) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6023
			case OM_UNSUPPORTED_CONFIG:
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6024
				warningcode =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6025
				    g_strdup("OM_UNSUPPORTED_CONFIG");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6026
				break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6027
			case OM_NO_DISKS_FOUND:
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6028
				warningcode =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6029
				    g_strdup("OM_NO_DISKS_FOUND");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6030
				break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6031
			case OM_NO_SPACE:
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6032
				warningcode =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6033
				    g_strdup("OM_NO_SPACE");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6034
				break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6035
			case OM_INVALID_DISK_PARTITION:
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6036
				warningcode =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6037
				    g_strdup("OM_INVALID_DISK_PARTITION");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6038
				break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6039
			case OM_FORMAT_UNKNOWN:
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6040
				warningsecondarytext =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6041
				    g_strdup("OM_FORMAT_UNKNOWN");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6042
				break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6043
			case OM_BAD_DISK_NAME:
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6044
				warningcode =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6045
				    g_strdup("OM_BAD_DISK_NAME");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6046
				break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6047
			case OM_CONFIG_EXCEED_DISK_SIZE:
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6048
				warningcode =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6049
				    g_strdup("OM_CONFIG_EXCEED_DISK_SIZE");
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6050
				break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6051
			default:
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6052
				warningcode =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6053
				    g_strdup(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6054
				    _("An unknown internal error (Orchestrator) occurred."));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6055
				break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6056
		}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6057
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6058
		g_warning("om_validate_and_resize_disk_partitions () failed.");
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6059
		g_warning("\tReason: %s", warningcode);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6060
		if (error == OM_UNSUPPORTED_CONFIG) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6061
			/* Create a specific error message */
588
40a31e921c17 1290 Malformed "Adjusted partition..." dialog
Matt <matt.keenan@sun.com>
parents: 587
diff changeset
  6062
			errorprimarytext =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6063
			    g_strdup(_("Unsupported partitioning configuration."));
588
40a31e921c17 1290 Malformed "Adjusted partition..." dialog
Matt <matt.keenan@sun.com>
parents: 587
diff changeset
  6064
			errorsecondarytext =
1398
3cd5b2156d4c imported patch oi-branding-cmd-gui-install
Alasdair Lumsden <al@everycity.co.uk>
parents: 872
diff changeset
  6065
			    g_strdup(_("OpenIndiana does not support changing the "
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6066
			    "partition type when two or more of that "
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6067
			    "type exist on the disk. Please Quit the "
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6068
			    "installer, run fdisk in the terminal window "
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6069
			    "to create the Solaris partition, then restart "
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6070
			    "the installer."));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6071
		} else {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6072
			/* Create a generic error message */
588
40a31e921c17 1290 Malformed "Adjusted partition..." dialog
Matt <matt.keenan@sun.com>
parents: 587
diff changeset
  6073
			errorprimarytext =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6074
			    g_strdup(_("Internal partitioning error."));
588
40a31e921c17 1290 Malformed "Adjusted partition..." dialog
Matt <matt.keenan@sun.com>
parents: 587
diff changeset
  6075
			errorsecondarytext =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6076
			    g_strdup_printf(_("Error code: %s\nThis is an unexpected, "
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6077
			    "internal error. It is not safe to continue with "
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6078
			    "installation of this system and you should quit the "
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6079
			    "installation process now."),
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6080
			    warningcode);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6081
		}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6082
		g_free(warningcode);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6083
	} else {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6084
		if (partitions == modifiedpartitions[activedisk]) {
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6085
			print_orig_vs_modified(alldiskinfo[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6086
			    originalpartitions[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6087
			    modifiedpartitions[activedisk]);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6088
			/*
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6089
			 * If the user didn't use the default partitioning
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6090
			 * layout, update the display if necessary to
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6091
			 * reflect actual partitioning.
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6092
			 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6093
			modifiedpartitions[activedisk] = newpartitions;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6094
			proposedpartitions[activedisk] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6095
			    modifiedpartitions[activedisk];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6096
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6097
			partitionsmatch =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6098
			    disk_partitions_match(partitions, newpartitions);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6099
			om_free_disk_partition_info(omhandle, partitions);
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6100
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6101
			g_debug("Proposed partitions, after adjustment by OM:");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6102
			print_partinfos(activedisk, alldiskinfo, modifiedpartitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6103
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6104
			if (!partitionsmatch) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6105
				warningprimarytext =
588
40a31e921c17 1290 Malformed "Adjusted partition..." dialog
Matt <matt.keenan@sun.com>
parents: 587
diff changeset
  6106
				    g_strdup(_("Adjustments were made to the size of "
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6107
				    "some new or resized partitions."));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6108
				warningsecondarytext =
588
40a31e921c17 1290 Malformed "Adjusted partition..." dialog
Matt <matt.keenan@sun.com>
parents: 587
diff changeset
  6109
				    g_strdup(_("The requested partitioning would require "
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6110
				    "existing partitions to be moved. \n\n"
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6111
				    "Click cancel to review the adjustments. "));
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6112
			}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6113
		} else if (partitions == defaultpartitions[activedisk]) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6114
			/*
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6115
			 * Even though the default layout shouldn't need
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6116
			 * any corrections from the validate_and_resize
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6117
			 * function, it can happen, probably because of
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6118
			 * rounding errors mapping megabytes to disk blocks
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6119
			 * etc.  So we need to overwrite the defaultlayout
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6120
			 * we created for the disk and replace it with what
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6121
			 * the orchestrator gave us back. But don't
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6122
			 * display this to the user or it will look stupid.
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6123
			 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6124
			defaultpartitions[activedisk] = newpartitions;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6125
			proposedpartitions[activedisk] =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6126
			    defaultpartitions[activedisk];
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6127
			om_free_disk_partition_info(omhandle, partitions);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6128
		}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6129
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6130
#endif /* (__i386) */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6131
	/* Nothing else right now */
588
40a31e921c17 1290 Malformed "Adjusted partition..." dialog
Matt <matt.keenan@sun.com>
parents: 587
diff changeset
  6132
	if (errorprimarytext != NULL) {
40a31e921c17 1290 Malformed "Adjusted partition..." dialog
Matt <matt.keenan@sun.com>
parents: 587
diff changeset
  6133
		gui_install_prompt_dialog(FALSE, FALSE, FALSE,
40a31e921c17 1290 Malformed "Adjusted partition..." dialog
Matt <matt.keenan@sun.com>
parents: 587
diff changeset
  6134
		    GTK_MESSAGE_ERROR,
40a31e921c17 1290 Malformed "Adjusted partition..." dialog
Matt <matt.keenan@sun.com>
parents: 587
diff changeset
  6135
		    errorprimarytext,
40a31e921c17 1290 Malformed "Adjusted partition..." dialog
Matt <matt.keenan@sun.com>
parents: 587
diff changeset
  6136
		    errorsecondarytext);
40a31e921c17 1290 Malformed "Adjusted partition..." dialog
Matt <matt.keenan@sun.com>
parents: 587
diff changeset
  6137
		g_free(errorprimarytext);
40a31e921c17 1290 Malformed "Adjusted partition..." dialog
Matt <matt.keenan@sun.com>
parents: 587
diff changeset
  6138
		g_free(errorsecondarytext);
40a31e921c17 1290 Malformed "Adjusted partition..." dialog
Matt <matt.keenan@sun.com>
parents: 587
diff changeset
  6139
		return (FALSE);
40a31e921c17 1290 Malformed "Adjusted partition..." dialog
Matt <matt.keenan@sun.com>
parents: 587
diff changeset
  6140
	}
40a31e921c17 1290 Malformed "Adjusted partition..." dialog
Matt <matt.keenan@sun.com>
parents: 587
diff changeset
  6141
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6142
	if (warningprimarytext != NULL) {
588
40a31e921c17 1290 Malformed "Adjusted partition..." dialog
Matt <matt.keenan@sun.com>
parents: 587
diff changeset
  6143
		prompt_retval = gui_install_prompt_dialog(TRUE, FALSE, FALSE,
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6144
		    GTK_MESSAGE_WARNING,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6145
		    warningprimarytext,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6146
		    warningsecondarytext);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6147
		g_free(warningprimarytext);
702
b9e20f47cf31 2822 GUI should display warning message, if disk/partition size is less than recommended
Matt Keenan <matt.keenan@sun.com>
parents: 699
diff changeset
  6148
		g_free(warningsecondarytext);
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6149
		if (prompt_retval == FALSE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6150
			/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6151
			 * Need to reevaluate the paritions and gaps, so do
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6152
			 * the same as if the Back button is pressed from the
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6153
			 * Timezone screen.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6154
			 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6155
			installationdisk_screen_set_default_focus(TRUE);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6156
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6157
			g_debug("Cancel selected reviewing proposed layout :");
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6158
			print_partinfos(activedisk, alldiskinfo, modifiedpartitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6159
			print_blkorder(alldiskinfo[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6160
			    modifiedprimaryblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6161
			    modifiedlogicalblkorder[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6162
			print_gui(MainWindow.InstallationDiskWindow);
588
40a31e921c17 1290 Malformed "Adjusted partition..." dialog
Matt <matt.keenan@sun.com>
parents: 587
diff changeset
  6163
			return (FALSE);
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6164
		}
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6165
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6166
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6167
	return (TRUE);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6168
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6169
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6170
void
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6171
installation_disk_store_data()
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6172
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6173
	disk_parts_t *partitions = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6174
	const gchar *diskname = (alldiskinfo[activedisk]->disk_name);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6175
	partition_info_t *partition = NULL;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6176
	gint i = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6177
	int status = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6178
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6179
	partitions = proposedpartitions[activedisk];
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6180
	InstallationProfile.diskname = diskname;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6181
	InstallationProfile.disktype =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6182
	    orchestrator_om_get_disk_type(alldiskinfo[activedisk]);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6183
	InstallationProfile.disksize =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6184
	    orchestrator_om_get_disk_sizegb(alldiskinfo[activedisk]);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6185
#if defined(__i386)
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6186
	for (i = 0; i < OM_NUMPART; i++) {
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6187
		partition = &partitions->pinfo[i];
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6188
		if (IS_SOLARIS_PAR(partition->partition_type,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6189
		    partition->content_type)) {
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6190
			InstallationProfile.installpartsize =
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6191
			    orchestrator_om_get_partition_sizegb(partition);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6192
			break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6193
		}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6194
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6195
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6196
	/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6197
	 * Tell orchestrator to use this partitioning layout for install
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6198
	 * Only gets applied after om_perform_install() is called so not
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6199
	 * too late yet.
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6200
	 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6201
	status = om_set_disk_partition_info(omhandle,
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6202
	    proposedpartitions[activedisk]);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6203
	if (status != OM_SUCCESS) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6204
		status = om_get_error();
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6205
		/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6206
		 * If setting the partition info failed, things are
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6207
		 * screwed but this is unlikely since the partition
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6208
		 * data was already validated with any necessary
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6209
		 * adjustments already made by the validation call
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6210
		 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6211
		g_critical("Failed to set proposed partitioning layout");
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6212
		g_critical("Error code is: %d", status);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6213
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6214
#endif
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6215
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6216
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6217
static disk_parts_t *
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6218
installation_disk_create_default_layout(disk_info_t *diskinfo)
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6219
{
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6220
	disk_parts_t *partitions;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6221
	partition_info_t *partinfo;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6222
	gint i = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6223
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6224
	partitions = g_new0(disk_parts_t, 1);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6225
	partitions->disk_name = g_strdup(diskinfo->disk_name);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6226
	/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6227
	 * New suggested partition layout:
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6228
	 * partition   0:  type = Solaris, size = diskcapacity, active = TRUE
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6229
	 * partition 1-3:  type = Unused,  size = 0, active = FALSE
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6230
	 */
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6231
	for (i = 0; i < FD_NUMPART; i++) {
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6232
		partinfo = &partitions->pinfo[i];
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6233
		partinfo->partition_id = i+1;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6234
		partinfo->partition_order = i+1;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6235
		partinfo->partition_offset = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6236
		partinfo->content_type = OM_CTYPE_UNKNOWN;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6237
		if (i == 0) {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6238
			partinfo->partition_type = SUNIXOS2;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6239
			partinfo->partition_size = (uint64_t)
233
77e7268f9c10 3448 GUI needs to be enhanced in order to support +1TB phase 1 project
Jan Damborsky <jan.damborsky@sun.com>
parents: 191
diff changeset
  6240
			    orchestrator_om_get_disk_sizemb(diskinfo);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6241
			partinfo->active = B_TRUE;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6242
		} else {
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6243
			partinfo->partition_type = UNUSED;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6244
			partinfo->partition_size = 0;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6245
			partinfo->active = B_FALSE;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6246
		}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6247
	}
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6248
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6249
	/* Initialize all 32 possible logicals */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6250
	for (i = FD_NUMPART; i < OM_NUMPART; i++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6251
		partinfo = &partitions->pinfo[i];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6252
		partinfo->partition_id = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6253
		partinfo->partition_size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6254
		partinfo->partition_offset = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6255
		partinfo->partition_order = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6256
		partinfo->partition_type = UNUSED;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6257
		partinfo->content_type = OM_CTYPE_UNKNOWN;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6258
		partinfo->active = B_FALSE;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6259
		partinfo->partition_size_sec = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6260
		partinfo->partition_offset_sec = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6261
	}
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6262
	return (partitions);
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6263
}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6264
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6265
static LogicalPartition *
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6266
get_logical_partition_at_pos(gint index,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6267
	LogicalPartition *startlogical)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6268
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6269
	LogicalPartition *curlogical = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6270
	gint logicalorder = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6271
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6272
	for (curlogical = startlogical;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6273
	    curlogical != NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6274
	    curlogical = curlogical->next) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6275
		logicalorder++;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6276
		if (logicalorder == index) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6277
			return (curlogical);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6278
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6279
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6280
	return (NULL);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6281
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6282
static void
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6283
update_logical_disk_partitions_from_ui(disk_parts_t *partitions)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6284
{
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6285
	gint pidx = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6286
	gint lidx = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6287
	partition_info_t *primpartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6288
	partition_info_t *logpartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6289
	gint primparttype;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6290
	LogicalPartition *curlogical = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6291
	LogicalPartition *startlogical = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6292
	GtkSpinButton *logspinner = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6293
	GtkComboBox *logcombo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6294
	GtkLabel *logavaillabel = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6295
	gfloat size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6296
	const gchar *availtext;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6297
	gint comboindex = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6298
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6299
	for (pidx = 0; pidx < FD_NUMPART; pidx++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6300
		primpartinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6301
		    orchestrator_om_get_part_by_blkorder(partitions, pidx);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6302
		g_assert(primpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6303
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6304
		primparttype = orchestrator_om_get_partition_type(primpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6305
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6306
		if (IS_EXT_PAR(primparttype) &&
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6307
		    MainWindow.InstallationDiskWindow.startlogical[pidx] != NULL) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6308
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6309
			/* If this primary is Extended, update it's logicals */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6310
			startlogical =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6311
			    MainWindow.InstallationDiskWindow.startlogical[pidx];
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6312
			for (lidx = FD_NUMPART;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6313
			    lidx < OM_NUMPART;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6314
			    lidx++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6315
				logpartinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6316
				    orchestrator_om_get_part_by_blkorder(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6317
				    partitions,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6318
				    lidx);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6319
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6320
				if (logpartinfo) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6321
					/* Get LogicalPartition struct from linked list */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6322
					curlogical = get_logical_partition_at_pos(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6323
					    (lidx+1)-FD_NUMPART,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6324
					    startlogical);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6325
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6326
					/* If no curlogical or hasn't changed try next one */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6327
					if ((!curlogical) ||
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6328
					    (curlogical &&
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6329
					    (!curlogical->typechange &&
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6330
					    !curlogical->sizechange)))
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6331
						continue;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6332
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6333
					logcombo = GTK_COMBO_BOX(curlogical->typecombo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6334
					logspinner = GTK_SPIN_BUTTON(curlogical->sizespinner);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6335
					logavaillabel = GTK_LABEL(curlogical->availlabel);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6336
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6337
					size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6338
					comboindex =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6339
					    gtk_combo_box_get_active(logcombo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6340
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6341
					/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6342
					 * For Unused partitions as spin button
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6343
					 * has been reset to 0 so use the
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6344
					 * partition size itself.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6345
					 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6346
					if (comboindex != UNUSED_PARTITION) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6347
						size = (gfloat)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6348
						    gtk_spin_button_get_value(logspinner);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6349
					} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6350
						size = orchestrator_om_round_mbtogb(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6351
						    logpartinfo->partition_size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6352
					}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6353
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6354
					if (curlogical->sizechange == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6355
						orchestrator_om_set_partition_sizegb(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6356
						    logpartinfo, size);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6357
					}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6358
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6359
					if (curlogical->typechange == TRUE) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6360
						switch (comboindex) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6361
							case UNUSED_PARTITION:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6362
								logpartinfo->partition_type = UNUSED;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6363
								break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6364
							case SOLARIS_PARTITION:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6365
								logpartinfo->partition_type = SUNIXOS2;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6366
								break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6367
							default:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6368
								g_warning(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6369
								    "Logical partition %d type is invalid",
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6370
								    lidx+1);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6371
								break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6372
						}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6373
					}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6374
					update_blkorder_from_partinfo(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6375
					    modifiedlogicalblkorder[activedisk],
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6376
					    logpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6377
				} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6378
					/* No More logicals */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6379
					break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6380
				}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6381
			}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6382
		}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6383
	}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6384
}
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6385
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6386
/*
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6387
 * Updates partition structure based on GUI's partitioning controls
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6388
 * Skips over partitions that haven't been modified so as not to
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6389
 * bork an unsupported partition type or the precise size of the
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6390
 * partition.
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6391
 */
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6392
static void
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6393
update_disk_partitions_from_ui(disk_parts_t *partitions)
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6394
{
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6395
	GtkSpinButton *primspinner = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6396
	GtkComboBox *primcombo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6397
	GtkLabel *primavaillabel = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6398
	partition_info_t *primpartinfo = NULL;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6399
	gint pidx = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6400
	const gchar *availtext;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6401
	gint comboindex = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6402
	gint primparttype;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6403
	gfloat size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6404
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6405
	g_return_if_fail(partitions);
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6406
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6407
	for (pidx = 0; pidx < FD_NUMPART; pidx++) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6408
		primpartinfo =
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6409
		    orchestrator_om_get_part_by_blkorder(partitions, pidx);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6410
		g_assert(primpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6411
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6412
		primparttype = orchestrator_om_get_partition_type(primpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6413
		primcombo = GTK_COMBO_BOX
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6414
		    (MainWindow.InstallationDiskWindow.partcombo[pidx]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6415
		primspinner = GTK_SPIN_BUTTON
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6416
		    (MainWindow.InstallationDiskWindow.partspin[pidx]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6417
		primavaillabel = GTK_LABEL
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6418
		    (MainWindow.InstallationDiskWindow.partavail[pidx]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6419
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6420
		if ((!activediskisreadable) ||
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6421
		    (MainWindow.InstallationDiskWindow.parttypechanges[pidx] == TRUE) ||
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6422
		    (MainWindow.InstallationDiskWindow.partsizechanges[pidx] == TRUE)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6423
			size = 0;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6424
			comboindex = gtk_combo_box_get_active(primcombo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6425
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6426
			/*
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6427
			 * For Unused partitions as spin button has been reset
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6428
			 * to 0 therefore we must use the actual partition size.
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6429
			 */
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6430
			if (comboindex != UNUSED_PARTITION) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6431
				size = (gfloat)
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6432
				    gtk_spin_button_get_value(primspinner);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6433
			} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6434
				size = orchestrator_om_round_mbtogb(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6435
				    primpartinfo->partition_size);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6436
			}
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6437
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6438
			if ((!activediskisreadable) ||
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6439
			    (MainWindow.InstallationDiskWindow.partsizechanges[pidx] ==
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6440
			    TRUE)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6441
				orchestrator_om_set_partition_sizegb(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6442
				    primpartinfo, size);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6443
			}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6444
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6445
			if ((!activediskisreadable) ||
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6446
			    (MainWindow.InstallationDiskWindow.parttypechanges[pidx] ==
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6447
			    TRUE)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6448
				switch (comboindex) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6449
					case UNUSED_PARTITION:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6450
						primpartinfo->partition_type = UNUSED;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6451
						break;
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6452
					case SOLARIS_PARTITION:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6453
						primpartinfo->partition_type = SUNIXOS2;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6454
						break;
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6455
					case EXTENDED_PARTITION:
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6456
						primpartinfo->partition_type = EXTDOS;
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6457
						break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6458
					default:
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6459
						g_warning("Partition %d type is invalid", pidx+1);
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6460
						break;
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6461
				}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6462
			}
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6463
			update_blkorder_from_partinfo(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6464
			    modifiedprimaryblkorder[activedisk], primpartinfo);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6465
			update_logical_disk_partitions_from_ui(partitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6466
		} else {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6467
			if (IS_EXT_PAR(primparttype)) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6468
				update_logical_disk_partitions_from_ui(
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6469
				    partitions);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6470
			}
35
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6471
		}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6472
	}
a0e6501f33f0 Backed out changeset d97906c1641d
Virginia Wray <Virginia.Wray@Sun.COM>
parents:
diff changeset
  6473
}
392
ddb3f64c2dc5 3796 Focus remaining on the "Next" button rather than going to the first thing in the panel that appears after you press "Next"
jedy@pampas
parents: 386
diff changeset
  6474
ddb3f64c2dc5 3796 Focus remaining on the "Next" button rather than going to the first thing in the panel that appears after you press "Next"
jedy@pampas
parents: 386
diff changeset
  6475
/*
ddb3f64c2dc5 3796 Focus remaining on the "Next" button rather than going to the first thing in the panel that appears after you press "Next"
jedy@pampas
parents: 386
diff changeset
  6476
 * Set the default widget with focus.
500
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  6477
 * When activedisk is not set, the default
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  6478
 * widget for installation disk screen is
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  6479
 * the 1st bootable disk button, or the 1st
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  6480
 * usable disk button, or the 1st available
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  6481
 * disk button. Otherwise activedisk is the
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  6482
 * default.
392
ddb3f64c2dc5 3796 Focus remaining on the "Next" button rather than going to the first thing in the panel that appears after you press "Next"
jedy@pampas
parents: 386
diff changeset
  6483
 */
ddb3f64c2dc5 3796 Focus remaining on the "Next" button rather than going to the first thing in the panel that appears after you press "Next"
jedy@pampas
parents: 386
diff changeset
  6484
void
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6485
installationdisk_screen_set_default_focus(gboolean back_button)
392
ddb3f64c2dc5 3796 Focus remaining on the "Next" button rather than going to the first thing in the panel that appears after you press "Next"
jedy@pampas
parents: 386
diff changeset
  6486
{
500
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  6487
	if (activedisk < 0)
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  6488
		activedisk = get_default_disk_index();
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  6489
	if (activedisk >= 0) {
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  6490
		gtk_widget_grab_focus(diskbuttons[activedisk]);
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6491
		if (back_button &&
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6492
		    proposedpartitions[activedisk] !=
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6493
		    defaultpartitions[activedisk]) {
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6494
			restore_unused_partitions(activedisk,
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6495
			    proposedpartitions[activedisk]);
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6496
		}
500
a203780b62bc 7436 disk radio button behaves like toggle button and breaks Orca.
jedy@pampas
parents: 437
diff changeset
  6497
	}
587
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  6498
	if (MainWindow.MileStoneComplete[OM_UPGRADE_TARGET_DISCOVERY] == TRUE &&
672
981123e8a988 13034 Need extended partition support in the GUI
Matt Keenan <matt.keenan@sun.com>
parents: 599
diff changeset
  6499
	    get_default_disk_index() < 0) {
587
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  6500
		gtk_widget_set_sensitive(MainWindow.nextbutton, FALSE);
de7482a4146b 1130 Disk screen of installer needs to give better indication that no disks present
Matt <matt.keenan@sun.com>
parents: 500
diff changeset
  6501
	}
688
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  6502
4cd5a9a2640b 13862 Pre-existing logical partition slow to be marked with warning
Darren Kenny <Darren.Kenny@Sun.COM>
parents: 672
diff changeset
  6503
	update_data_loss_warnings();
392
ddb3f64c2dc5 3796 Focus remaining on the "Next" button rather than going to the first thing in the panel that appears after you press "Next"
jedy@pampas
parents: 386
diff changeset
  6504
}