Commit 20547882 authored by David Zeuthen's avatar David Zeuthen

Update "Edit GPT Partition" dialog

Remove the Microsoft "Basic Data Partition" specific attributes (they
are not used at all on Linux) and add support for the generic "Hide
from firmware" attribute.
Signed-off-by: 's avatarDavid Zeuthen <zeuthen@gmail.com>
parent 850c16f2
......@@ -9,6 +9,7 @@
#include "config.h"
#include <inttypes.h>
#include <glib/gi18n.h>
#include "gduapplication.h"
......@@ -39,10 +40,8 @@ typedef struct
GtkWidget *type_combobox;
GtkWidget *name_entry;
GtkWidget *system_checkbutton;
GtkWidget *hide_from_firmware_checkbutton;
GtkWidget *bootable_checkbutton;
GtkWidget *readonly_checkbutton;
GtkWidget *hidden_checkbutton;
GtkWidget *do_not_automount_checkbutton;
} EditPartitionData;
......@@ -88,14 +87,10 @@ edit_partition_get (EditPartitionData *data,
name = g_strdup (gtk_entry_get_text (GTK_ENTRY (data->name_entry)));
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->system_checkbutton)))
flags |= (1UL<<0);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->hide_from_firmware_checkbutton)))
flags |= (1UL<<1);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->bootable_checkbutton)))
flags |= (1UL<<2);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->readonly_checkbutton)))
flags |= (1ULL<<60);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->hidden_checkbutton)))
flags |= (1ULL<<62);
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data->do_not_automount_checkbutton)))
flags |= (1ULL<<63);
}
else if (g_strcmp0 (data->partition_table_type, "dos") == 0)
{
......@@ -251,10 +246,8 @@ edit_partition_populate (EditPartitionData *data)
gtk_entry_set_text (GTK_ENTRY (data->name_entry), udisks_partition_get_name (data->partition));
flags = udisks_partition_get_flags (data->partition);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->system_checkbutton), (flags & (1UL<< 0)) != 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->hide_from_firmware_checkbutton), (flags & (1UL<< 1)) != 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->bootable_checkbutton), (flags & (1UL<< 2)) != 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->readonly_checkbutton), (flags & (1ULL<<60)) != 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->hidden_checkbutton), (flags & (1ULL<<62)) != 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->do_not_automount_checkbutton), (flags & (1ULL<<63)) != 0);
}
else if (g_strcmp0 (data->partition_table_type, "dos") == 0)
{
......@@ -292,21 +285,17 @@ gdu_partition_dialog_show (GduWindow *window,
&data->builder));
data->name_entry = GTK_WIDGET (gtk_builder_get_object (data->builder, "name-entry"));
data->system_checkbutton = GTK_WIDGET (gtk_builder_get_object (data->builder, "system-checkbutton"));
data->hide_from_firmware_checkbutton = GTK_WIDGET (gtk_builder_get_object (data->builder,
"hide-from-firmware-checkbutton"));
data->bootable_checkbutton = GTK_WIDGET (gtk_builder_get_object (data->builder, "bootable-checkbutton"));
data->readonly_checkbutton = GTK_WIDGET (gtk_builder_get_object (data->builder, "readonly-checkbutton"));
data->hidden_checkbutton = GTK_WIDGET (gtk_builder_get_object (data->builder, "hidden-checkbutton"));
data->do_not_automount_checkbutton = GTK_WIDGET (gtk_builder_get_object (data->builder, "do-not-automount-checkbutton"));
g_signal_connect (data->name_entry,
"notify::text", G_CALLBACK (edit_partition_property_changed), data);
g_signal_connect (data->system_checkbutton,
"notify::active", G_CALLBACK (edit_partition_property_changed), data);
g_signal_connect (data->bootable_checkbutton,
"notify::active", G_CALLBACK (edit_partition_property_changed), data);
g_signal_connect (data->readonly_checkbutton,
g_signal_connect (data->hide_from_firmware_checkbutton,
"notify::active", G_CALLBACK (edit_partition_property_changed), data);
g_signal_connect (data->hidden_checkbutton,
"notify::active", G_CALLBACK (edit_partition_property_changed), data);
g_signal_connect (data->do_not_automount_checkbutton,
g_signal_connect (data->bootable_checkbutton,
"notify::active", G_CALLBACK (edit_partition_property_changed), data);
}
else if (g_strcmp0 (data->partition_table_type, "dos") == 0)
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.16.0 on Sat Jan 25 10:20:06 2014 -->
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="edit-gpt-partition-dialog">
......@@ -27,7 +28,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
......@@ -44,7 +44,6 @@
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
</object>
<packing>
......@@ -76,7 +75,9 @@
<property name="label" translatable="yes">_Type</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">type-combobox</property>
<style><class name="dim-label"/></style>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -106,7 +107,9 @@
<property name="label" translatable="yes">_Name</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">name-entry</property>
<style><class name="dim-label"/></style>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -132,13 +135,12 @@
</child>
<child>
<object class="GtkCheckButton" id="system-checkbutton">
<property name="label" translatable="yes">_System partition</property>
<property name="label" translatable="yes">_System Partition</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_markup" translatable="yes">Used to indicate that the partition and its contents are required for the OS/Platform to function. Special care should be taken to not delete or overwrite the contents</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
......@@ -158,27 +160,6 @@
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_markup" translatable="yes">Legacy BIOS Bootable. This is equivalent to Master Boot Record &lt;i&gt;bootable&lt;/i&gt; flag. It is normally only used for GPT partitions on MBR systems</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="readonly-checkbutton">
<property name="label" translatable="yes">_Read-Only</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_markup" translatable="yes">If set, some OSes may mount or use the contents of the partition as read-only instead of read-write</property>
<property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
......@@ -191,41 +172,39 @@
</packing>
</child>
<child>
<object class="GtkCheckButton" id="hidden-checkbutton">
<property name="label" translatable="yes">H_idden</property>
<property name="use_action_appearance">False</property>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_markup" translatable="yes">If set, some OSes may hide the contents of the partition in their user interfaces</property>
<property name="use_action_appearance">False</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Flags</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<property name="lines">0</property>
<style>
<class name="dim-label"/>
</style>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="do-not-automount-checkbutton">
<property name="label" translatable="yes">Do Not _Automount</property>
<object class="GtkCheckButton" id="hide-from-firmware-checkbutton">
<property name="label" translatable="yes">Hide from _Firmware</property>
<property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_markup" translatable="yes">If set, some OSes may not automount the contents of the partition</property>
<property name="use_action_appearance">False</property>
<property name="tooltip_markup" translatable="yes">Legacy BIOS Bootable. This is equivalent to Master Boot Record &lt;i&gt;bootable&lt;/i&gt; flag. It is normally only used for GPT partitions on MBR systems</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">6</property>
<property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
......@@ -236,15 +215,6 @@
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment