[master/rhel7-branch] Let users configure autopart options in interactive text ks. (#1001061)
by Samantha N. Bueno
This patch fixes an issue where partition configuration options were
never applied if a user performed an interactive ks install.
Resolves: rhbz#1001061
---
pyanaconda/ui/tui/spokes/storage.py | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py
index 7eaa95c..d73c2bc 100644
--- a/pyanaconda/ui/tui/spokes/storage.py
+++ b/pyanaconda/ui/tui/spokes/storage.py
@@ -70,6 +70,10 @@ class StorageSpoke(NormalTUISpoke):
self.errors = []
self.warnings = []
+ if not flags.automatedInstall:
+ # default to using autopart for interactive installs
+ self.data.autopart.autopart = True
+
@property
def completed(self):
retval = bool(self.storage.rootDevice and not self.errors)
@@ -213,10 +217,6 @@ class StorageSpoke(NormalTUISpoke):
return key
def apply(self):
- if not flags.automatedInstall:
- # default to using autopart for interactive installs
- self.data.autopart.autopart = True
-
self.autopart = self.data.autopart.autopart
self.data.ignoredisk.onlyuse = self.selected_disks[:]
self.data.clearpart.drives = self.selected_disks[:]
@@ -338,6 +338,12 @@ class AutoPartSpoke(NormalTUISpoke):
return True
def apply(self):
+ # kind of a hack, but if we're actually getting to this spoke, there
+ # is no doubt that we are doing autopartitioning, so set autopart to
+ # True. In the case of ks installs which may not have defined any
+ # partition options, autopart was never set to True, causing some
+ # issues. (rhbz#1001061)
+ self.data.autopart.autopart = True
self.data.clearpart.type = self.clearPartType
self.data.clearpart.initAll = True
--
1.8.3.1
10 years, 8 months
[master][PATCH] Make sure XklWrapper isn't dumped to the anaconda-tb file
by Vratislav Podzimek
Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
---
pyanaconda/exception.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py
index 651358c..7c80ca7 100644
--- a/pyanaconda/exception.py
+++ b/pyanaconda/exception.py
@@ -208,6 +208,7 @@ def initExceptionHandling(anaconda):
programArch=os.uname()[4],
attrSkipList=["_intf._actions",
"_intf._currentAction._xklwrapper",
+ "_intf._currentAction._spokes[\"KeyboardSpoke\"]._xkl_wrapper",
"_intf._currentAction.language.translations",
"_intf._currentAction.language.locales",
"_intf._currentAction._spokes[\"PasswordSpoke\"]._oldweak",
--
1.7.11.7
10 years, 8 months
PPC: strengthen PReP-picking algorithm (v3)
by Will Woods
This version of the patch fixes a potential misfire if bootDevice() is called
before partitioning is committed - we could have a "create" action with a
later "destroy" action, which would render the earlier "create" moot.
The differences from the previous patch are:
- if a.format.type == "prepboot":
+ if a.format.type == "prepboot" and a.device in
self.storage.devices:
...which works because (if I understand dlehman correctly) devices that are
*actually* going to be created by the requested actions will be in the
self.storage.devices list.. and I removed a stray footnote from the commit
message.
-w
10 years, 8 months
[PATCH rhel7-branch] (v2) Catch race of network device state vs reading its config properties (#919478, #1005681)
by Radek Vykydal
Fedora bz: #980576
Catch the infamous
DBusException: org.freedesktop.DBus.Error.UnknownMethod:
Method "Get" with signature "ss" on interface "org.freedesktop.DBus.Properties"
doesn't exist
exception.
Object with path from devices's IPXConfig property is valid only if
its device is in ACTIVATED state.
---
pyanaconda/nm.py | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/nm.py b/pyanaconda/nm.py
index dd0df99..0c88800 100644
--- a/pyanaconda/nm.py
+++ b/pyanaconda/nm.py
@@ -53,7 +53,12 @@ class SettingNotFoundError(ValueError):
return self.__repr__()
class DeviceSettingsNotFoundError(ValueError):
- """Settings (NMRemoteConnection object was not found"""
+ """Settings NMRemoteConnection object was not found"""
+ def __str__(self):
+ return self.__repr__()
+
+class UnknownMethodGetError(Exception):
+ """Object does not have Get, most probably being invalid"""
def __str__(self):
return self.__repr__()
@@ -86,6 +91,8 @@ def _get_property(object_path, prop, interface_name_suffix=""):
except GLib.GError as e:
if "org.freedesktop.DBus.Error.AccessDenied" in e.message:
return None
+ elif "org.freedesktop.DBus.Error.UnknownMethod" in e.message:
+ raise UnknownMethodGetError
else:
raise
@@ -305,7 +312,12 @@ def nm_device_ip_config(name, version=4):
if config == "/":
return []
- addresses = _get_property(config, "Addresses", dbus_iface)
+ try:
+ addresses = _get_property(config, "Addresses", dbus_iface)
+ # object is valid only if device is in ACTIVATED state (racy)
+ except UnknownMethodGetError:
+ return []
+
addr_list = []
for addr, prefix, gateway in addresses:
# TODO - look for a library function (could have used IPy but byte order!)
@@ -317,7 +329,12 @@ def nm_device_ip_config(name, version=4):
gateway_str = nm_dbus_ay_to_ipv6(gateway)
addr_list.append([addr_str, prefix, gateway_str])
- nameservers = _get_property(config, "Nameservers", dbus_iface)
+ try:
+ nameservers = _get_property(config, "Nameservers", dbus_iface)
+ # object is valid only if device is in ACTIVATED state (racy)
+ except UnknownMethodGetError:
+ return []
+
ns_list = []
for ns in nameservers:
# TODO - look for a library function
@@ -341,7 +358,11 @@ def nm_ntp_servers_from_dhcp():
for device in active_devices:
# harvest NTP server addresses from DHCPv4
dhcp4_path = nm_device_property(device, "Dhcp4Config")
- options = _get_property(dhcp4_path, "Options", ".DHCP4Config")
+ try:
+ options = _get_property(dhcp4_path, "Options", ".DHCP4Config")
+ # object is valid only if device is in ACTIVATED state (racy)
+ except UnknownMethodGetError:
+ options = None
if options and 'ntp_servers' in options:
# NTP server addresses returned by DHCP are whitespace delimited
ntp_servers_string = options["ntp_servers"]
--
1.7.11.7
10 years, 8 months
[master] Test for and fix gettext problems
by David Shea
The first patch adds a test that will fail if xgettext displays warnings while
processing anything in POTFILES. The warnings about undetected language types
are fixed in the second patch, and the warnings about unparameterized strings
are fixed in the third.
The second patch also fixes our handling of glade files. xgettext sort of
supports glade but doesn't very well with glade3, and for that reason we had
some makefile rules to use intltool to extract strings. Except we were only
looking for glade files in one directory and then never using the generated
headers. This fixes that.
I reorganized POTFILES.in a little bit, so the .pot file will look it changed
it a lot because all of the anaconda strings are at the bottom now. The filename
comments in the .pot should be the same for the files that force a language in
Rules-extract (anaconda, data/liveinst/gnome/fedora-welcome), but it will
change for the files that switch to intltool generated headers (*.glade,
fedora-welcome.desktop.in).
10 years, 8 months
[PATCH rhel6-branch] PPC: strengthen PReP-picking algorithm (#877852)
by Will Woods
pSeries-style systems can have multiple PReP partitions, as long as
there's only one per disk. It's kind of like the x86 MBR that way.
The current code in booty and platform.py *always* picks the first PReP
partition, which will fail if if you have (e.g.) an OS already installed
on /dev/sda and you're doing a new install onto /dev/sdb.
This patch adds ppcBootloaderInfo.pickPReP(), which tries to find the
best PReP partition to use according to the following rules:
1) If we're creating a new PReP partition, use that.
2) Otherwise, if there's a PReP partition already on the disk that
contains /boot (or "any disk that contains /boot" if mdraid), use that.
3) Failing that, use the first available PReP partition (as before).
This should make mkofboot actually install yaboot into the correct PReP
partition.
IPSeriesPPC.bootDevice() has been changed to use this same algorithm, so
the two of them will agree about what the boot device is.
¹ If /boot is an mdraid device, check each of its member disks for a
PReP partition, and return the first one found.
---
booty/ppc.py | 38 +++++++++++++++++++++++++++++++++-----
platform.py | 11 ++---------
2 files changed, 35 insertions(+), 14 deletions(-)
diff --git a/booty/ppc.py b/booty/ppc.py
index 6f62071..3fc5582 100644
--- a/booty/ppc.py
+++ b/booty/ppc.py
@@ -7,6 +7,36 @@ from bootloaderInfo import *
import iutil
class ppcBootloaderInfo(bootloaderInfo):
+ def pickPReP(self):
+ # if we created a new PReP partition, pick that
+ for a in self.storage.findActions(type="create", obj="format"):
+ if a.format.type == "prepboot":
+ return a.device
+
+ # otherwise, look at the existing PReP partitions.
+ prepdevs = []
+ for dev in self.storage.fsset.devices:
+ if (dev.format.type == "prepboot" and
+ dev.partedPartition.getFlag(parted.PARTITION_BOOT)):
+ prepdevs.append(dev)
+
+ # (no PReP found? bail out.)
+ if len(prepdevs) == 0:
+ return None
+
+ # we'd prefer a PReP partition that's on the same disk as /boot.
+ bootdev = self.storage.mountpoints.get("/boot",self.storage.rootDevice)
+ if bootdev.type == "mdarray":
+ bootdisks = set(p.disk for p in bootdev.parents)
+ else:
+ bootdisks = set([bootdev.disk])
+ for dev in prepdevs:
+ if dev.disk in bootdisks:
+ return dev
+
+ # failing that, return the first PReP partition we found
+ return prepdevs[0]
+
def getBootDevs(self, bl):
import parted
@@ -14,10 +44,9 @@ class ppcBootloaderInfo(bootloaderInfo):
machine = iutil.getPPCMachine()
if machine == 'pSeries':
- for dev in self.storage.fsset.devices:
- if (dev.format.type == "prepboot" and
- dev.partedPartition.getFlag(parted.PARTITION_BOOT)):
- retval.append(dev.path)
+ prep = self.pickPReP()
+ if prep:
+ retval.append(prep.path)
elif machine == 'PMac':
for dev in self.storage.fsset.devices:
if dev.format.type == "hfs" and dev.format.bootable:
@@ -31,7 +60,6 @@ class ppcBootloaderInfo(bootloaderInfo):
except KeyError:
# Try / if we don't have this we're not going to work
device = self.storage.rootDevice
-
retval.append(device.path)
else:
if bl.getDevice():
diff --git a/platform.py b/platform.py
index 7bc75ec..e866133 100644
--- a/platform.py
+++ b/platform.py
@@ -392,15 +392,8 @@ class IPSeriesPPC(PPC):
_maxBootPartSize = 10
def bootDevice(self):
- bootDev = None
-
- # We want the first PReP partition.
- for device in self.anaconda.id.storage.partitions:
- if device.format.type == "prepboot":
- bootDev = device
- break
-
- return bootDev
+ # use booty's PReP-picking algorithm
+ return self.anaconda.id.bootloader.pickPReP()
def bootloaderChoices(self, bl):
ret = {}
--
1.8.3.1
10 years, 8 months
[PATCH] Fix lightbox signal handling (#1000927)
by David Shea
As part of this, I also:
- Removed anaconda_lb_destroy, since it didn't do anything useful that
a signal handler couldn't
- Bumped the soversion of libAnacondaWidgets since this removes a
public interface
- Switched to using destroy handlers to cleanup the lightbox
references that are set in other objects
- Renamed some variables and added some comments to hopefully make it
easier to tell what's actually going on
---
pyanaconda/ui/gui/tools/run-spoke.py | 2 +-
pyanaconda/ui/gui/utils.py | 2 +-
scripts/makeupdates | 2 +-
widgets/src/Makefile.am | 2 +-
widgets/src/lightbox.c | 290 ++++++++++++++++++++++++-----------
widgets/src/lightbox.h | 1 -
6 files changed, 206 insertions(+), 93 deletions(-)
diff --git a/pyanaconda/ui/gui/tools/run-spoke.py b/pyanaconda/ui/gui/tools/run-spoke.py
index d3a83a4..d7101cf 100755
--- a/pyanaconda/ui/gui/tools/run-spoke.py
+++ b/pyanaconda/ui/gui/tools/run-spoke.py
@@ -20,7 +20,7 @@ if len(sys.argv)<2:
sys.exit(1)
# This is a hack to make sure the AnacondaWidgets library gets loaded
-ctypes.CDLL("libAnacondaWidgets.so.0", ctypes.RTLD_GLOBAL)
+ctypes.CDLL("libAnacondaWidgets.so.1", ctypes.RTLD_GLOBAL)
# Logging always needs to be set up first thing, or there'll be tracebacks.
from pyanaconda import anaconda_log
diff --git a/pyanaconda/ui/gui/utils.py b/pyanaconda/ui/gui/utils.py
index 38e0f4c..06847dc 100644
--- a/pyanaconda/ui/gui/utils.py
+++ b/pyanaconda/ui/gui/utils.py
@@ -101,7 +101,7 @@ def enlightbox(mainWindow, dialog):
ANACONDA_WINDOW_GROUP.add_window(lightbox)
dialog.set_transient_for(lightbox)
yield
- AnacondaWidgets.lb_destroy(lightbox)
+ lightbox.destroy()
def ignoreEscape(dlg):
"""Prevent a dialog from accepting the escape keybinding, which emits a
diff --git a/scripts/makeupdates b/scripts/makeupdates
index 6e291fd..273428a 100755
--- a/scripts/makeupdates
+++ b/scripts/makeupdates
@@ -358,7 +358,7 @@ def copyUpdatedWidgets(updates, cwd):
os.system('make')
- files = ["libAnacondaWidgets.so", "libAnacondaWidgets.so.0", "libAnacondaWidgets.so.0.0.0"]
+ files = ["libAnacondaWidgets.so", "libAnacondaWidgets.so.1", "libAnacondaWidgets.so.1.0.0"]
for f in files:
path = os.path.normpath(cwd + "/widgets/src/.libs/" + f)
if os.path.islink(path) and not os.path.exists(updates + libdir + os.path.basename(path)):
diff --git a/widgets/src/Makefile.am b/widgets/src/Makefile.am
index 4b3bfde..aaab626 100644
--- a/widgets/src/Makefile.am
+++ b/widgets/src/Makefile.am
@@ -65,7 +65,7 @@ libAnacondaWidgets_la_CFLAGS = $(GTK_CFLAGS) $(GLADEUI_CFLAGS) $(LIBXKLAVIER_CFL
-DWIDGETS_DATADIR=$(WIDGETSDATA)\
-DTZMAP_DATADIR=$(TZMAPDATA)
libAnacondaWidgets_la_LIBADD = $(GTK_LIBS) $(GLADEUI_LIBS) $(LIBXKLAVIER_LIBS)
-libAnacondaWidgets_la_LDFLAGS = $(LTLIBINTL)
+libAnacondaWidgets_la_LDFLAGS = $(LTLIBINTL) -version-info 1:0:0
libAnacondaWidgets_la_SOURCES = $(SOURCES) $(HDRS) \
glade-adaptor.c
diff --git a/widgets/src/lightbox.c b/widgets/src/lightbox.c
index 43edeeb..41b01db 100644
--- a/widgets/src/lightbox.c
+++ b/widgets/src/lightbox.c
@@ -32,48 +32,150 @@
*/
#include <cairo.h>
-#include <gdk/gdk.h>
#include <gtk/gtk.h>
+#include <string.h>
#include "lightbox.h"
-/* GObject ID for the parent window's configure-event signal handler */
+/* GObject IDs for the parent window's signal handlers */
#define ANACONDA_LB_PARENT_CONFIGURE_EVENT "anaconda-configure-event"
+#define ANACONDA_LB_PARENT_DESTROY_EVENT "anaconda-destroy-event"
-static void anaconda_lb_move_window_to_parent(GtkWidget *parent,
- GdkEventConfigure *e,
- GtkWindow *window)
+/*
+ * Restack the lightbox and its parent any time we receive a configure-event
+ * on the lightbox
+ */
+static gboolean anaconda_lb_configure_event(
+ GtkWidget *lightbox,
+ GdkEvent *event,
+ gpointer parent
+ )
{
- GdkWindow *p_window, *w_window;
- int pwidth, pheight, width, height, px, py, x, y, nx, ny;
+ GdkWindow *g_parent_window;
+ GdkWindow *g_lightbox_window;
+
+ if ((event->type != GDK_CONFIGURE) ||
+ !GTK_IS_WIDGET(parent) ||
+ !GTK_IS_WINDOW(lightbox))
+ {
+ return FALSE;
+ }
+
+ g_lightbox_window = gtk_widget_get_window(lightbox);
+ if (NULL == g_lightbox_window)
+ {
+ return FALSE;
+ }
+
+ g_parent_window = gtk_widget_get_window(GTK_WIDGET(parent));
+ if (NULL == g_parent_window)
+ {
+ return FALSE;
+ }
+
+ gdk_window_restack(g_lightbox_window, g_parent_window, TRUE);
+ return FALSE;
+}
+
+/*
+ * Adjust the lightbox any time the parent window's size, position or stacking
+ * changes. Returns FALSE to allow signal processing to continue.
+ */
+static gboolean anaconda_lb_parent_configure_event(
+ GtkWidget *parent,
+ GdkEvent *event,
+ gpointer lightbox
+ )
+{
+ /* Always return FALSE to continue processing for this signal. */
+ GdkWindow *g_parent_window;
+ GdkWindow *g_lightbox_window;
+
+ if ((event->type != GDK_CONFIGURE) ||
+ !GTK_IS_WIDGET(parent) ||
+ !GTK_IS_WINDOW(lightbox))
+ {
+ return FALSE;
+ }
- if (!GTK_IS_WIDGET(parent) || !GTK_IS_WINDOW(window))
- return;
+ g_lightbox_window = gtk_widget_get_window(GTK_WIDGET(lightbox));
+ if (NULL == g_lightbox_window)
+ {
+ /*
+ * No underlying GdkWindow. This may mean the lightbox is not yet
+ * realized, but whatever the cause, there's nothing we can do here.
+ */
+ return FALSE;
+ }
- p_window = gtk_widget_get_window (parent);
- w_window = gtk_widget_get_window (GTK_WIDGET(window));
+ /* Resize and move the window according to the event data */
+ gdk_window_move_resize(g_lightbox_window,
+ event->configure.x,
+ event->configure.y,
+ event->configure.width,
+ event->configure.height
+ );
- if (!GDK_IS_WINDOW(p_window) || !GDK_IS_WINDOW(w_window))
- return;
+ g_parent_window = gtk_widget_get_window(parent);
+ if (NULL == g_parent_window)
+ {
+ return FALSE;
+ }
- pwidth = gdk_window_get_width (p_window);
- pheight = gdk_window_get_height (p_window);
- gdk_window_get_position(p_window, &px, &py);
+ /* Stack the lightbox above the parent */
+ gdk_window_restack(g_lightbox_window, g_parent_window, TRUE);
- width = gdk_window_get_width (w_window);
- height = gdk_window_get_height (w_window);
- gdk_window_get_position(w_window, &x, &y);
+ return FALSE;
+}
- nx = px + pwidth / 2 - width / 2;
- ny = py + pheight / 2 - height / 2;
+/* Clean up references to lightbox held by the parent window */
+static void anaconda_lb_cleanup(GtkWidget *lightbox, gpointer user_data)
+{
+ guint *p_configure_event_handler;
+ guint *p_destroy_event_handler;
+ GtkWindow *parent;
- if (x != nx || y != ny)
+ /* Remove the signal handlers set on the parent window */
+ if (GTK_IS_WINDOW(lightbox))
{
- gdk_window_move (w_window, nx, ny);
- gdk_window_restack(w_window, p_window, TRUE);
+ parent = gtk_window_get_transient_for(GTK_WINDOW(lightbox));
+ if (GTK_IS_WINDOW(parent))
+ {
+ p_configure_event_handler = g_object_get_data(G_OBJECT(lightbox),
+ ANACONDA_LB_PARENT_CONFIGURE_EVENT);
+ p_destroy_event_handler = g_object_get_data(G_OBJECT(lightbox),
+ ANACONDA_LB_PARENT_DESTROY_EVENT);
+
+ if (NULL != p_configure_event_handler)
+ {
+ g_signal_handler_disconnect(parent, GPOINTER_TO_UINT(p_configure_event_handler));
+ }
+
+ if (NULL != p_destroy_event_handler)
+ {
+ g_signal_handler_disconnect(parent, GPOINTER_TO_UINT(p_destroy_event_handler));
+ }
+ }
}
+}
+
+static void anaconda_lb_cleanup_parent(GtkWidget *parent, gpointer user_data)
+{
+ GtkWidget *lightbox;
- g_object_set_data(G_OBJECT(window), ANACONDA_LB_PARENT_CONFIGURE_EVENT, NULL);
+ /* If the parent window is destoryed, destroy the lightbox */
+ if (GTK_IS_WIDGET(user_data))
+ {
+ lightbox = GTK_WIDGET(user_data);
+
+ /*
+ * Clear the destroy id so we don't try disconnecting a signal handler
+ * while the handler is being called.
+ */
+ g_object_set_data(G_OBJECT(lightbox), ANACONDA_LB_PARENT_DESTROY_EVENT, NULL);
+
+ gtk_widget_destroy(lightbox);
+ }
}
/**
@@ -89,87 +191,99 @@ static void anaconda_lb_move_window_to_parent(GtkWidget *parent,
GtkWindow *anaconda_lb_show_over(GtkWindow *window)
{
GtkWindow *lightbox;
- GdkWindow *w_window;
- GdkWindow *l_window;
- int width, height;
- cairo_t *cr;
- cairo_pattern_t *pattern;
+ GdkWindow *g_window;
+
+ GdkWindow *g_lightbox_window;
+ GdkWindow *g_parent_window;
cairo_surface_t *surface;
- guint signal_handler;
+ cairo_pattern_t *pattern;
+ cairo_t *cr;
+ guint configure_event_handler;
+ guint destroy_event_handler;
+
+ /* Create a new window on top of the parent */
lightbox = (GTK_WINDOW(gtk_window_new(GTK_WINDOW_TOPLEVEL)));
gtk_window_set_transient_for(lightbox, window);
+
+ /* Disable the window decorations */
gtk_window_set_decorated(lightbox, FALSE);
gtk_window_set_has_resize_grip(lightbox, FALSE);
+
+ /* Set the initial position to the center of the parent */
gtk_window_set_position(lightbox, GTK_WIN_POS_CENTER_ON_PARENT);
- gtk_window_set_type_hint (lightbox, GDK_WINDOW_TYPE_HINT_SPLASHSCREEN);
+
+ /* Indicate we will handle drawing the widget so no theme is applied */
gtk_widget_set_app_paintable(GTK_WIDGET(lightbox), TRUE);
+ gtk_window_set_type_hint(lightbox, GDK_WINDOW_TYPE_HINT_SPLASHSCREEN);
- w_window = gtk_widget_get_window (GTK_WIDGET(window));
- width = gdk_window_get_width(w_window);
- height = gdk_window_get_height(w_window);
- gtk_window_set_default_size(lightbox, width, height);
- gtk_widget_realize(GTK_WIDGET(lightbox));
- l_window = gtk_widget_get_window (GTK_WIDGET(lightbox));
- gdk_window_set_background_pattern (l_window, NULL);
- gtk_widget_show(GTK_WIDGET(lightbox));
- surface = gdk_window_create_similar_surface(l_window,
- CAIRO_CONTENT_COLOR_ALPHA,
- width, height);
-
- cr = cairo_create (surface);
- gdk_cairo_set_source_window(cr, w_window, 0, 0);
- cairo_paint(cr);
- cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 0.5);
- cairo_paint(cr);
- cairo_destroy(cr);
+ /* Set the lightbox to the parent window's dimensions */
+ g_window = gtk_widget_get_window(GTK_WIDGET(window));
+ gtk_window_set_default_size(lightbox,
+ gdk_window_get_width(g_window),
+ gdk_window_get_height(g_window)
+ );
- pattern = cairo_pattern_create_for_surface (surface);
- gdk_window_set_background_pattern(l_window, pattern);
- cairo_pattern_destroy (pattern);
+ /* handle restacking events */
+ g_signal_connect(lightbox, "configure-event",
+ G_CALLBACK(anaconda_lb_configure_event), window);
/* make the shade move with the parent window */
- signal_handler = g_signal_connect(window, "configure-event",
- G_CALLBACK (anaconda_lb_move_window_to_parent), lightbox);
+ configure_event_handler = g_signal_connect(window, "configure-event",
+ G_CALLBACK(anaconda_lb_parent_configure_event), lightbox);
+
+ /* cleanup */
+ g_signal_connect(lightbox, "destroy", G_CALLBACK(anaconda_lb_cleanup), NULL);
+ destroy_event_handler = g_signal_connect(window, "destroy",
+ G_CALLBACK(anaconda_lb_cleanup_parent), lightbox);
- /* Save the signal handler in the lightbox so we can remove it later */
+ /*
+ * Save the signal handlers set on the parent so they can be removed when
+ * the lightbox is destroyed.
+ */
g_object_set_data(G_OBJECT(lightbox), ANACONDA_LB_PARENT_CONFIGURE_EVENT,
- GUINT_TO_POINTER(signal_handler));
+ GUINT_TO_POINTER(configure_event_handler));
- return lightbox;
-}
+ g_object_set_data(G_OBJECT(lightbox), ANACONDA_LB_PARENT_DESTROY_EVENT,
+ GUINT_TO_POINTER(destroy_event_handler));
-/**
- * anaconda_lb_destroy:
- * @lightbox: a #GtkWindow
- *
- * Destroys the previously used lightbox.
- *
- * Since: 1.0
- */
-void anaconda_lb_destroy(GtkWindow *lightbox)
-{
- GtkWindow *window;
- gpointer p_signal_handler;
+ /*
+ * NB: We should probably be handling the draw signal in order to refresh
+ * the transparent pattern from the parent window whenver something
+ * changes, but by the time things get to the signal handler the surface is
+ * already set up and doesn't support alpha channels and replacing it
+ * doesn't seem to work quite right. Besides, none of these windows are
+ * supposed to move anyway.
+ */
- /* Disconnect the configure-event from the contained window */
- if (GTK_IS_WINDOW(lightbox))
- {
- window = gtk_window_get_transient_for(GTK_WINDOW(lightbox));
+ /* Realize the window to initialize the Gdk objects */
+ gtk_widget_realize(GTK_WIDGET(lightbox));
+ g_lightbox_window = gtk_widget_get_window(GTK_WIDGET(lightbox));
+ g_parent_window = gtk_widget_get_window(GTK_WIDGET(window));
- p_signal_handler = g_object_get_data(G_OBJECT(lightbox),
- ANACONDA_LB_PARENT_CONFIGURE_EVENT);
- if ((NULL != p_signal_handler) && GTK_IS_WINDOW(window))
- {
- /* XXX HAAAAAAACK:
- * If the configure-event signal handler for the contained window
- * hasn't fired yet, do it now.
- */
- g_signal_emit_by_name(window, "configure-event", window);
+ /* Create a new surface that supports alpha content */
+ surface = gdk_window_create_similar_surface(g_lightbox_window,
+ CAIRO_CONTENT_COLOR_ALPHA,
+ gdk_window_get_width(g_parent_window),
+ gdk_window_get_height(g_parent_window));
+ cr = cairo_create(surface);
- g_signal_handler_disconnect(window, GPOINTER_TO_UINT(p_signal_handler));
- }
- }
+ /* Use the parent window as a pattern and paint it on the surface */
+ gdk_cairo_set_source_window(cr, g_parent_window, 0, 0);
+ cairo_paint(cr);
- gtk_widget_destroy(GTK_WIDGET(lightbox));
+ /* Paint a black, 50% transparent shade */
+ cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 0.5);
+ cairo_paint(cr);
+
+ cairo_destroy(cr);
+
+ /* Use the surface we painted as the window background */
+ pattern = cairo_pattern_create_for_surface(surface);
+ gdk_window_set_background_pattern(g_lightbox_window, pattern);
+ cairo_pattern_destroy(pattern);
+
+ gtk_widget_show_all(GTK_WIDGET(lightbox));
+
+ return lightbox;
}
diff --git a/widgets/src/lightbox.h b/widgets/src/lightbox.h
index 3a97010..db83bd5 100644
--- a/widgets/src/lightbox.h
+++ b/widgets/src/lightbox.h
@@ -23,6 +23,5 @@
#include <gtk/gtk.h>
GtkWindow *anaconda_lb_show_over(GtkWindow *window);
-void anaconda_lb_destroy(GtkWindow *lightbox);
#endif
--
1.8.3.1
10 years, 8 months
[PATCH] Remove some more unused imports.
by Chris Lumens
---
pyanaconda/anaconda.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/pyanaconda/anaconda.py b/pyanaconda/anaconda.py
index 5bc83e5..9a5aecc 100644
--- a/pyanaconda/anaconda.py
+++ b/pyanaconda/anaconda.py
@@ -28,7 +28,7 @@
# Matt Wilson <msw(a)rpath.com>
#
-import os, time
+import os
import sys
from constants import ROOT_PATH
from tempfile import mkstemp
@@ -36,7 +36,6 @@ from tempfile import mkstemp
from pyanaconda.bootloader import get_bootloader
from pyanaconda import constants
from pyanaconda import addons
-from pyanaconda.i18n import _
import logging
log = logging.getLogger("anaconda")
--
1.8.1.2
10 years, 8 months
[PATCH rhel6-branch] PPC: strengthen PReP-picking algorithm (#877852)
by Will Woods
pSeries-style systems can have multiple PReP partitions, as long as
there's only one per disk. It's kind of like the x86 MBR that way.
The current code in booty and platform.py *always* picks the first PReP
partition, which will fail if if you have (e.g.) an OS already installed
on /dev/sda and you're doing a new install onto /dev/sdb.
This patch adds ppcBootloaderInfo.pickPReP(), which tries to find the
best PReP partition to use according to the following rules:
1) If we're creating a new PReP partition, use that;
2) Otherwise, if there's a PReP partition already on the disk that
contains /boot, use that;
3) Failing that, use the first available PReP partition (as before).
This should make mkofboot actually install yaboot into the correct PReP
partition.
IPSeriesPPC.bootDevice() has been changed to use this same algorithm, so
the two of them will agree about what the boot device is.
---
booty/ppc.py | 37 ++++++++++++++++++++++++++++++++-----
platform.py | 11 ++---------
2 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/booty/ppc.py b/booty/ppc.py
index 6f62071..401f505 100644
--- a/booty/ppc.py
+++ b/booty/ppc.py
@@ -7,6 +7,35 @@ from bootloaderInfo import *
import iutil
class ppcBootloaderInfo(bootloaderInfo):
+ def pickPReP(self):
+ # if we created a new PReP partition, pick that
+ for a in self.storage.findActions(type="create", obj="format"):
+ if a.format.type == "prepboot":
+ return a.device
+
+ # otherwise, look at the existing PReP partitions.
+ prepdevs = []
+ for dev in self.storage.fsset.devices:
+ if (dev.format.type == "prepboot" and
+ dev.partedPartition.getFlag(parted.PARTITION_BOOT)):
+ prepdevs.append(dev)
+
+ # we'd prefer a PReP partition that's on the same disk as /boot.
+ try:
+ bootdisk = self.storage.mountpoints["/boot"].disk
+ except KeyError:
+ bootdisk = self.storage.rootDevice.disk
+ for dev in prepdevs:
+ if dev.disk == bootdisk:
+ return dev
+
+ # failing that, return the first PReP partition we found
+ if len(prepdevs) != 0:
+ return prepdevs[0]
+
+ # Alas, no PReP to be found..
+ return None
+
def getBootDevs(self, bl):
import parted
@@ -14,10 +43,9 @@ class ppcBootloaderInfo(bootloaderInfo):
machine = iutil.getPPCMachine()
if machine == 'pSeries':
- for dev in self.storage.fsset.devices:
- if (dev.format.type == "prepboot" and
- dev.partedPartition.getFlag(parted.PARTITION_BOOT)):
- retval.append(dev.path)
+ prep = self.pickPReP()
+ if prep:
+ retval.append(prep.path)
elif machine == 'PMac':
for dev in self.storage.fsset.devices:
if dev.format.type == "hfs" and dev.format.bootable:
@@ -31,7 +59,6 @@ class ppcBootloaderInfo(bootloaderInfo):
except KeyError:
# Try / if we don't have this we're not going to work
device = self.storage.rootDevice
-
retval.append(device.path)
else:
if bl.getDevice():
diff --git a/platform.py b/platform.py
index 7bc75ec..e866133 100644
--- a/platform.py
+++ b/platform.py
@@ -392,15 +392,8 @@ class IPSeriesPPC(PPC):
_maxBootPartSize = 10
def bootDevice(self):
- bootDev = None
-
- # We want the first PReP partition.
- for device in self.anaconda.id.storage.partitions:
- if device.format.type == "prepboot":
- bootDev = device
- break
-
- return bootDev
+ # use booty's PReP-picking algorithm
+ return self.anaconda.id.bootloader.pickPReP()
def bootloaderChoices(self, bl):
ret = {}
--
1.8.3.1
10 years, 8 months