forked from AuroraMiddleware/gtk
windowcontrols: gtk_widget_get_root() can return NULL
This commit is contained in:
parent
557a363b4f
commit
d9cc589339
@ -107,12 +107,12 @@ static char *
|
||||
get_layout (GtkWindowControls *self)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (self);
|
||||
GtkWidget *toplevel;
|
||||
GtkRoot *root;
|
||||
char *layout_desc, *layout_half;
|
||||
char **tokens;
|
||||
|
||||
toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
|
||||
if (!GTK_IS_WINDOW (toplevel))
|
||||
root = gtk_widget_get_root (widget);
|
||||
if (!root || !GTK_IS_WINDOW (root))
|
||||
return NULL;
|
||||
|
||||
if (self->decoration_layout)
|
||||
@ -221,7 +221,6 @@ static void
|
||||
update_window_buttons (GtkWindowControls *self)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (self);
|
||||
GtkWidget *toplevel;
|
||||
char *layout;
|
||||
char **tokens;
|
||||
int i;
|
||||
@ -230,10 +229,11 @@ update_window_buttons (GtkWindowControls *self)
|
||||
gboolean resizable;
|
||||
gboolean deletable;
|
||||
gboolean empty = TRUE;
|
||||
GtkRoot *root;
|
||||
GtkWindow *window = NULL;
|
||||
|
||||
toplevel = GTK_WIDGET (gtk_widget_get_root (widget));
|
||||
if (!GTK_IS_WINDOW (toplevel))
|
||||
root = gtk_widget_get_root (widget);
|
||||
if (!root || !GTK_IS_WINDOW (root))
|
||||
{
|
||||
set_empty (self, TRUE);
|
||||
|
||||
@ -242,23 +242,12 @@ update_window_buttons (GtkWindowControls *self)
|
||||
|
||||
clear_controls (self);
|
||||
|
||||
if (GTK_IS_WINDOW (toplevel))
|
||||
{
|
||||
window = GTK_WINDOW (toplevel);
|
||||
|
||||
is_sovereign_window = !gtk_window_get_modal (window) &&
|
||||
gtk_window_get_transient_for (window) == NULL;
|
||||
maximized = gtk_window_is_maximized (window);
|
||||
resizable = gtk_window_get_resizable (window);
|
||||
deletable = gtk_window_get_deletable (window);
|
||||
}
|
||||
else
|
||||
{
|
||||
is_sovereign_window = TRUE;
|
||||
maximized = FALSE;
|
||||
resizable = TRUE;
|
||||
deletable = TRUE;
|
||||
}
|
||||
window = GTK_WINDOW (root);
|
||||
is_sovereign_window = !gtk_window_get_modal (window) &&
|
||||
gtk_window_get_transient_for (window) == NULL;
|
||||
maximized = gtk_window_is_maximized (window);
|
||||
resizable = gtk_window_get_resizable (window);
|
||||
deletable = gtk_window_get_deletable (window);
|
||||
|
||||
layout = get_layout (self);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user