gtk-ui: start using GtkToolbar for Meego window

This gets rid of MuxWindow (and the related icon code and images)
for good: Now a specially named GtkToolbar and buttons inside it get
a special treatment from meego gtk theme engine, and end up looking
like Mx window title bar

The meego build will look a bit odd with other gtk themes, though
This commit is contained in:
Jussi Kukkonen 2010-03-25 11:50:24 +02:00 committed by Patrick Ohly
parent 975d0eb677
commit a75ac70bbe
12 changed files with 634 additions and 1546 deletions

View File

@ -22,7 +22,6 @@ dist_icon_DATA = sync.png
themercdir = $(datadir)/syncevolution/
themerc_DATA = \
close.png close_hover.png settings.png settings_hover.png \
sync-generic.png \
sync-spinner.gif \
sync-ui.rc
@ -51,7 +50,7 @@ bin_PROGRAMS = $(GUI_PROGRAMS)
sync_ui_SOURCES = \
main.c sync-ui.c sync-ui.h sync-ui-config.c sync-ui-config.h \
mux-frame.c mux-frame.h mux-window.c mux-window.h mux-icon-button.c mux-icon-button.h \
mux-frame.c mux-frame.h \
sync-config-widget.c sync-config-widget.h \
gtkinfobar.c gtkinfobar.h

Binary file not shown.

Before

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 767 B

View File

@ -1,283 +0,0 @@
/*
* Copyright (C) 2009 Intel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) version 3.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
/* TODO: should probably ensure specific icon size? */
#include "mux-icon-button.h"
enum {
PROP_0,
PROP_TOGGLEABLE,
PROP_PIXBUF_NORMAL,
PROP_PIXBUF_ACTIVE,
PROP_PIXBUF_PRELIGHT,
PROP_PIXBUF_SELECTED,
PROP_PIXBUF_INSENSITIVE
};
G_DEFINE_TYPE (MuxIconButton, mux_icon_button, GTK_TYPE_BUTTON)
static void
mux_icon_button_get_property (GObject *object, guint property_id,
GValue *value, GParamSpec *pspec)
{
MuxIconButton *btn = MUX_ICON_BUTTON (object);
switch (property_id) {
case PROP_TOGGLEABLE:
g_value_set_boolean (value, btn->toggleable);
break;
case PROP_PIXBUF_NORMAL:
g_value_set_object (value, mux_icon_button_get_pixbuf (btn, GTK_STATE_NORMAL));
break;
case PROP_PIXBUF_ACTIVE:
g_value_set_object (value, mux_icon_button_get_pixbuf (btn, GTK_STATE_ACTIVE));
break;
case PROP_PIXBUF_PRELIGHT:
g_value_set_object (value, mux_icon_button_get_pixbuf (btn, GTK_STATE_PRELIGHT));
break;
case PROP_PIXBUF_SELECTED:
g_value_set_object (value, mux_icon_button_get_pixbuf (btn, GTK_STATE_SELECTED));
break;
case PROP_PIXBUF_INSENSITIVE:
g_value_set_object (value, mux_icon_button_get_pixbuf (btn, GTK_STATE_INSENSITIVE));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
mux_icon_button_set_property (GObject *object, guint property_id,
const GValue *value, GParamSpec *pspec)
{
MuxIconButton *btn = MUX_ICON_BUTTON (object);
GdkPixbuf *pixbuf;
switch (property_id) {
case PROP_TOGGLEABLE:
btn->toggleable = g_value_get_boolean (value);
break;
case PROP_PIXBUF_NORMAL:
pixbuf = GDK_PIXBUF (g_value_get_object (value));
mux_icon_button_set_pixbuf (btn, GTK_STATE_NORMAL, pixbuf);
break;
case PROP_PIXBUF_ACTIVE:
pixbuf = GDK_PIXBUF (g_value_get_object (value));
mux_icon_button_set_pixbuf (btn, GTK_STATE_ACTIVE, pixbuf);
break;
case PROP_PIXBUF_PRELIGHT:
pixbuf = GDK_PIXBUF (g_value_get_object (value));
mux_icon_button_set_pixbuf (btn, GTK_STATE_PRELIGHT, pixbuf);
break;
case PROP_PIXBUF_SELECTED:
pixbuf = GDK_PIXBUF (g_value_get_object (value));
mux_icon_button_set_pixbuf (btn, GTK_STATE_SELECTED, pixbuf);
break;
case PROP_PIXBUF_INSENSITIVE:
pixbuf = GDK_PIXBUF (g_value_get_object (value));
mux_icon_button_set_pixbuf (btn, GTK_STATE_INSENSITIVE, pixbuf);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
mux_icon_button_dispose (GObject *object)
{
int i;
MuxIconButton *btn = MUX_ICON_BUTTON (object);
for (i = 0; i < 5; i++) {
if (btn->pixbufs[i]) {
g_object_unref (btn->pixbufs[i]);
btn->pixbufs[i] = NULL;
}
}
G_OBJECT_CLASS (mux_icon_button_parent_class)->dispose (object);
}
static void
mux_icon_button_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
MuxIconButton *btn = MUX_ICON_BUTTON (widget);
if (btn->pixbufs[GTK_STATE_NORMAL]) {
requisition->width = gdk_pixbuf_get_width (btn->pixbufs[GTK_STATE_NORMAL]);
requisition->height = gdk_pixbuf_get_height (btn->pixbufs[GTK_STATE_NORMAL]);
}
}
static gboolean
mux_icon_button_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GdkRectangle dirty_area, btn_area;
MuxIconButton *btn = MUX_ICON_BUTTON (widget);
GdkPixbuf *pixbuf;
GtkStateType state;
if (btn->active) {
/* this is a active toggle button */
state = GTK_STATE_ACTIVE;
} else {
state = GTK_WIDGET_STATE (widget);
}
if (btn->pixbufs[state]) {
pixbuf = btn->pixbufs[state];
} else {
pixbuf = btn->pixbufs[GTK_STATE_NORMAL];
}
if (!pixbuf)
return FALSE;
btn_area.width = gdk_pixbuf_get_width (pixbuf);
btn_area.height = gdk_pixbuf_get_height (pixbuf);
btn_area.x = widget->allocation.x + (widget->allocation.width - btn_area.width) / 2;
btn_area.y = widget->allocation.y + (widget->allocation.height - btn_area.height) / 2;
if (gdk_rectangle_intersect (&event->area, &widget->allocation, &dirty_area) &&
gdk_rectangle_intersect (&btn_area, &dirty_area, &dirty_area)) {
gdk_draw_pixbuf (widget->window, NULL, pixbuf,
dirty_area.x - btn_area.x, dirty_area.y - btn_area.y,
dirty_area.x, dirty_area.y,
dirty_area.width, dirty_area.height,
GDK_RGB_DITHER_NORMAL, 0, 0);
}
return FALSE;
}
static void
mux_icon_button_clicked (GtkButton *button)
{
MuxIconButton *icon_button = MUX_ICON_BUTTON (button);
if (icon_button->toggleable) {
icon_button->active = !icon_button->active;
}
}
static void
mux_icon_button_class_init (MuxIconButtonClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkButtonClass *button_class = GTK_BUTTON_CLASS (klass);
GParamSpec *pspec;
object_class->get_property = mux_icon_button_get_property;
object_class->set_property = mux_icon_button_set_property;
object_class->dispose = mux_icon_button_dispose;
widget_class->size_request = mux_icon_button_size_request;
widget_class->expose_event = mux_icon_button_expose;
button_class->clicked = mux_icon_button_clicked;
pspec = g_param_spec_boolean ("toggleable",
"Toggleable",
"Is icon button button a toggle or normal",
FALSE,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_TOGGLEABLE, pspec);
pspec = g_param_spec_object ("normal-state-pixbuf",
"Normal state pixbuf",
"GdkPixbuf for GTK_STATE_NORMAL",
GDK_TYPE_PIXBUF,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_PIXBUF_NORMAL, pspec);
pspec = g_param_spec_object ("active-state-pixbuf",
"Active state pixbuf",
"GdkPixbuf for GTK_STATE_ACTIVE",
GDK_TYPE_PIXBUF,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_PIXBUF_ACTIVE, pspec);
pspec = g_param_spec_object ("prelight-state-pixbuf",
"Prelight state pixbuf",
"GdkPixbuf for GTK_STATE_PRELIGHT",
GDK_TYPE_PIXBUF,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_PIXBUF_PRELIGHT, pspec);
pspec = g_param_spec_object ("selected-state-pixbuf",
"Selected state pixbuf",
"GdkPixbuf for GTK_STATE_SELECTED",
GDK_TYPE_PIXBUF,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_PIXBUF_SELECTED, pspec);
pspec = g_param_spec_object ("insensitive-state-pixbuf",
"Insensitive state pixbuf",
"GdkPixbuf for GTK_STATE_INSENSITIVE",
GDK_TYPE_PIXBUF,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_PIXBUF_INSENSITIVE, pspec);
}
static void
mux_icon_button_init (MuxIconButton *self)
{
}
GtkWidget*
mux_icon_button_new (GdkPixbuf *normal_pixbuf, gboolean toggleable)
{
return g_object_new (MUX_TYPE_ICON_BUTTON,
"normal-state-pixbuf", normal_pixbuf,
"toggleable", toggleable,
NULL);
}
void
mux_icon_button_set_pixbuf (MuxIconButton *button, GtkStateType state, GdkPixbuf *pixbuf)
{
if (button->pixbufs[state]) {
g_object_unref (button->pixbufs[state]);
}
button->pixbufs[state] = g_object_ref (pixbuf);
if (state == GTK_STATE_NORMAL) {
gtk_widget_queue_resize (GTK_WIDGET (button));
} else if (state == GTK_WIDGET_STATE (GTK_WIDGET (button))) {
gtk_widget_queue_draw (GTK_WIDGET (button));
}
}
GdkPixbuf*
mux_icon_button_get_pixbuf (MuxIconButton *button, GtkStateType state)
{
return button->pixbufs[state];
}
void
mux_icon_button_set_active (MuxIconButton *button, gboolean active)
{
button->active = active;
gtk_widget_queue_draw (GTK_WIDGET (button));
}
gboolean
mux_icon_button_get_active (MuxIconButton *button)
{
return button->active;
}

View File

@ -1,71 +0,0 @@
/*
* Copyright (C) 2009 Intel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) version 3.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef _MUX_ICON_BUTTON
#define _MUX_ICON_BUTTON
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define MUX_TYPE_ICON_BUTTON mux_icon_button_get_type()
#define MUX_ICON_BUTTON(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), MUX_TYPE_ICON_BUTTON, MuxIconButton))
#define MUX_ICON_BUTTON_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), MUX_TYPE_ICON_BUTTON, MuxIconButtonClass))
#define MUX_IS_ICON_BUTTON(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), MUX_TYPE_ICON_BUTTON))
#define MUX_IS_ICON_BUTTON_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), MUX_TYPE_ICON_BUTTON))
#define MUX_ICON_BUTTON_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), MUX_TYPE_ICON_BUTTON, MuxIconButtonClass))
typedef struct {
GtkButton parent;
GdkPixbuf *pixbufs[5];
gboolean toggleable;
gboolean active;
} MuxIconButton;
typedef struct {
GtkButtonClass parent_class;
} MuxIconButtonClass;
GType mux_icon_button_get_type (void);
GtkWidget* mux_icon_button_new (GdkPixbuf *normal_pixbuf, gboolean toggleable);
void mux_icon_button_set_pixbuf (MuxIconButton *button, GtkStateType state, GdkPixbuf *pixbuf);
GdkPixbuf* mux_icon_button_get_pixbuf (MuxIconButton *button, GtkStateType state);
/* for togglebuttons */
void mux_icon_button_set_active (MuxIconButton *button, gboolean active);
gboolean mux_icon_button_get_active (MuxIconButton *button);
G_END_DECLS
#endif

View File

@ -1,641 +0,0 @@
/*
* Copyright (C) 2009 Intel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) version 3.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include "mux-window.h"
#include "mux-icon-button.h"
static GdkColor mux_window_default_title_bar_bg = { 0, 0x3300, 0x3300, 0x3300 };
#define MUX_WINDOW_DEFAULT_TITLE_BAR_HEIGHT 63
GType
mux_decorations_get_type (void)
{
static GType etype = 0;
if (etype == 0) {
static const GFlagsValue values[] = {
{ MUX_DECOR_CLOSE, "MUX_CLOSE", "close" },
{ MUX_DECOR_SETTINGS, "MUX_SETTINGS", "settings" },
{ 0, NULL, NULL }
};
etype = g_flags_register_static (g_intern_static_string ("MuxDecorations"), values);
}
return etype;
}
enum {
PROP_0,
PROP_DECORATIONS,
PROP_BACK_TITLE,
};
enum {
SETTINGS_VISIBILITY_CHANGED,
LAST_SIGNAL
};
static guint mux_window_signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (MuxWindow, mux_window, GTK_TYPE_WINDOW)
#define GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), MUX_TYPE_WINDOW, MuxWindowPrivate))
typedef struct _MuxWindowPrivate MuxWindowPrivate;
struct _MuxWindowPrivate {
int dummy;
};
static void
mux_window_get_property (GObject *object, guint property_id,
GValue *value, GParamSpec *pspec)
{
MuxWindow *win = MUX_WINDOW (object);
switch (property_id) {
case PROP_DECORATIONS:
g_value_set_uint (value, win->decorations);
break;
case PROP_BACK_TITLE:
g_value_set_string (value,
gtk_button_get_label (GTK_BUTTON (win->back_btn)));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
mux_window_set_property (GObject *object, guint property_id,
const GValue *value, GParamSpec *pspec)
{
MuxWindow *win = MUX_WINDOW (object);
switch (property_id) {
case PROP_DECORATIONS:
mux_window_set_decorations (win, g_value_get_uint (value));
break;
case PROP_BACK_TITLE:
g_free (win->back_title);
win->back_title = g_strdup (g_value_get_string (value));
if (win->back_btn) {
gtk_button_set_label (GTK_BUTTON (win->back_btn), win->back_title);
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
}
static void
mux_window_update_style (MuxWindow *win)
{
GdkColor *title_bar_bg = NULL;
guint title_bar_height;
g_return_if_fail (win->title_bar);
gtk_widget_style_get (GTK_WIDGET (win),
"title-bar-height", &title_bar_height,
"title-bar-bg", &title_bar_bg,
NULL);
if (title_bar_bg) {
gtk_widget_modify_bg (win->title_bar, GTK_STATE_NORMAL, title_bar_bg);
gdk_color_free (title_bar_bg);
} else {
gtk_widget_modify_bg (win->title_bar, GTK_STATE_NORMAL,
&mux_window_default_title_bar_bg);
}
gtk_widget_set_size_request (win->title_bar, -1, title_bar_height);
}
static void
mux_window_style_set (GtkWidget *widget,
GtkStyle *previous)
{
MuxWindow *win = MUX_WINDOW (widget);
mux_window_update_style (win);
GTK_WIDGET_CLASS (mux_window_parent_class)->style_set (widget, previous);
}
static void
mux_window_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
gpointer callback_data)
{
MuxWindow *mux_win = MUX_WINDOW (container);
GtkBin *bin = GTK_BIN (container);
/* FIXME: call parents forall instead ? */
if (bin->child)
(* callback) (bin->child, callback_data);
if (mux_win->title_bar)
(* callback) (mux_win->title_bar, callback_data);
if (mux_win->notebook)
(* callback) (mux_win->notebook, callback_data);
}
static void
mux_window_add (GtkContainer *container,
GtkWidget *widget)
{
MuxWindowClass *klass;
GtkContainerClass *parent_container_class;
klass = MUX_WINDOW_GET_CLASS (container);
parent_container_class = GTK_CONTAINER_CLASS (g_type_class_peek_parent (klass));
parent_container_class->add (container, widget);
}
static void
mux_window_remove (GtkContainer *container,
GtkWidget *child)
{
MuxWindow *win = MUX_WINDOW (container);
GtkBin *bin = GTK_BIN (container);
if (child == win->title_bar) {
gtk_widget_unparent (win->title_bar);
win->title_bar = NULL;
} else if (child == win->notebook) {
gtk_widget_unparent (win->notebook);
win->notebook = NULL;
} else if (bin->child) {
if (bin->child == child) {
/* should call parents remove... */
gtk_widget_unparent (child);
bin->child = NULL;
}
}
}
static void
mux_window_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
GtkBin *bin = GTK_BIN (widget);
MuxWindow *mux_win = MUX_WINDOW (widget);
GtkRequisition req;
/* we will always be maximized so none of this should be necessary
* (requisition will never be used), but some widgets to assume
* size_request is called */
if (mux_win->title_bar && GTK_WIDGET_VISIBLE (mux_win->title_bar))
gtk_widget_size_request (mux_win->title_bar, &req);
if (bin->child && GTK_WIDGET_VISIBLE (bin->child))
gtk_widget_size_request (bin->child, &req);
if (mux_win->notebook && GTK_WIDGET_VISIBLE (mux_win->notebook))
gtk_widget_size_request (mux_win->notebook, &req);
requisition->width = 1024;
requisition->height = 600;
}
static void
mux_window_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkBin *bin = GTK_BIN (widget);
MuxWindow *mux_win = MUX_WINDOW (widget);
GtkAllocation child_allocation;
int xmargin, ymargin, title_height;
widget->allocation = *allocation;
xmargin = GTK_CONTAINER (widget)->border_width +
widget->style->xthickness;
ymargin = GTK_CONTAINER (widget)->border_width +
widget->style->ythickness;
title_height = 0;
if (mux_win->title_bar) {
GtkAllocation title_allocation;
GtkRequisition title_req;
gtk_widget_get_child_requisition (mux_win->title_bar, &title_req);
title_height = title_req.height;
title_allocation.x = allocation->x;
title_allocation.y = allocation->y;
title_allocation.width = allocation->width;
title_allocation.height = title_height;
gtk_widget_size_allocate (mux_win->title_bar, &title_allocation);
}
child_allocation.x = allocation->x + xmargin;
child_allocation.y = allocation->y + title_height + ymargin;
child_allocation.width = allocation->width - 2 * xmargin;
child_allocation.height = allocation->height - (2 * ymargin + title_height);
if (GTK_WIDGET_MAPPED (widget) &&
(child_allocation.x != mux_win->child_allocation.x ||
child_allocation.y != mux_win->child_allocation.y ||
child_allocation.width != mux_win->child_allocation.width ||
child_allocation.height != mux_win->child_allocation.height)) {
gdk_window_invalidate_rect (widget->window, &widget->allocation, FALSE);
}
if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) {
gtk_widget_size_allocate (bin->child, &child_allocation);
}
if (mux_win->notebook && GTK_WIDGET_VISIBLE (mux_win->notebook)) {
gtk_widget_size_allocate (mux_win->notebook, &child_allocation);
}
mux_win->child_allocation = child_allocation;
}
static void
mux_window_class_init (MuxWindowClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
GParamSpec *pspec;
g_type_class_add_private (klass, sizeof (MuxWindowPrivate));
object_class->get_property = mux_window_get_property;
object_class->set_property = mux_window_set_property;
widget_class->size_request = mux_window_size_request;
widget_class->size_allocate = mux_window_size_allocate;
widget_class->style_set = mux_window_style_set;
container_class->forall = mux_window_forall;
container_class->remove = mux_window_remove;
container_class->add = mux_window_add;
pspec = g_param_spec_uint ("title-bar-height",
"Title bar height",
"Total height of the title bar",
0, G_MAXUINT, MUX_WINDOW_DEFAULT_TITLE_BAR_HEIGHT,
G_PARAM_READWRITE);
gtk_widget_class_install_style_property(widget_class, pspec);
pspec = g_param_spec_boxed ("title-bar-bg",
"Title bar bg color",
"Color of the title bar background",
GDK_TYPE_COLOR,
G_PARAM_READWRITE);
gtk_widget_class_install_style_property(widget_class, pspec);
pspec = g_param_spec_flags ("decorations",
NULL,
"Bitfield of MuxDecorations defining used window decorations",
MUX_TYPE_DECORATIONS,
MUX_DECOR_CLOSE,
G_PARAM_READWRITE);
g_object_class_install_property (object_class,
PROP_DECORATIONS,
pspec);
pspec = g_param_spec_string ("back-title",
NULL,
"title of the back button in the window decoration",
"",
G_PARAM_READWRITE);
g_object_class_install_property (object_class,
PROP_BACK_TITLE,
pspec);
mux_window_signals[SETTINGS_VISIBILITY_CHANGED] =
g_signal_new ("settings-visibility-changed",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (MuxWindowClass, settings_visibility_changed),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0, NULL);
}
static void
mux_window_settings_clicked (MuxIconButton *button, MuxWindow *window)
{
gboolean active;
active = mux_icon_button_get_active (button);
mux_window_set_settings_visible (window, active);
}
static void
mux_window_close_clicked (MuxWindow *window)
{
/* this is how GtkDialog does it... */
GdkEvent *event;
event = gdk_event_new (GDK_DELETE);
event->any.window = g_object_ref (GTK_WIDGET (window)->window);
event->any.send_event = TRUE;
gtk_main_do_event (event);
gdk_event_free (event);
}
static GdkPixbuf*
load_icon (MuxWindow *window, const char *icon_name)
{
static GtkIconTheme *theme = NULL;
GdkScreen *screen;
GdkPixbuf *pixbuf;
if (!theme) {
screen = gtk_widget_get_screen (GTK_WIDGET (window));
theme = gtk_icon_theme_get_for_screen (screen);
}
pixbuf = gtk_icon_theme_load_icon (theme, icon_name,
48, 0, NULL);
/* FIXME: workaround until icons are in Moblin Netbook theme */
if (!pixbuf) {
char *str = g_strdup_printf ("%s/%s.png", THEMEDIR, icon_name);
pixbuf = gdk_pixbuf_new_from_file_at_size (str, 48, 48, NULL);
g_free (str);
}
if (!pixbuf) {
g_warning ("Icon '%s' not found in theme", icon_name);
pixbuf = gtk_widget_render_icon (GTK_WIDGET (window),
GTK_STOCK_MISSING_IMAGE,
GTK_ICON_SIZE_DIALOG,
NULL);
}
return pixbuf;
}
static void
bread_crumb_clicked_cb (GtkButton *btn, MuxWindow *window)
{
mux_window_set_current_page (window, -1);
}
static void
mux_window_build_title_bar (MuxWindow *window)
{
GtkWidget *box, *button_box, *btn, *align;
GdkPixbuf *pixbuf, *pixbuf_hover;
if (window->title_bar) {
gtk_widget_unparent (window->title_bar);
}
window->title_bar = gtk_event_box_new ();
gtk_widget_set_name (window->title_bar, "mux_window_title_bar");
gtk_widget_set_parent (window->title_bar, GTK_WIDGET (window));
gtk_widget_show (window->title_bar);
box = gtk_hbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window->title_bar), box);
gtk_widget_show (box);
align = gtk_alignment_new (0, 0.5, 0, 0);
gtk_box_pack_start (GTK_BOX (box), align, FALSE, FALSE, 4);
gtk_widget_show (align);
button_box = gtk_hbox_new (FALSE, 0);
gtk_widget_set_name (window->title_bar, "mux_window_bread_crumbs");
gtk_container_add (GTK_CONTAINER (align), button_box);
gtk_widget_show (button_box);
window->back_btn = gtk_button_new_with_label (window->back_title);
gtk_box_pack_start (GTK_BOX (button_box), window->back_btn,
FALSE, FALSE, 4);
g_signal_connect (window->back_btn, "clicked",
G_CALLBACK (bread_crumb_clicked_cb), window);
if (mux_window_get_current_page (window) != -1) {
gtk_widget_show (window->back_btn);
}
/*window->title_label = gtk_label_new (gtk_window_get_title (GTK_WINDOW (window)));
gtk_box_pack_start (GTK_BOX (box), window->title_label,
FALSE, FALSE, 0);
gtk_widget_show (window->title_label);*/
button_box = gtk_hbox_new (TRUE, 0);
gtk_box_pack_end (GTK_BOX (box), button_box, FALSE, FALSE, 4);
gtk_widget_show (button_box);
if (window->decorations & MUX_DECOR_CLOSE) {
pixbuf = load_icon (window, "close");
pixbuf_hover = load_icon (window, "close_hover");
btn = g_object_new (MUX_TYPE_ICON_BUTTON,
"normal-state-pixbuf", pixbuf,
"prelight-state-pixbuf", pixbuf_hover,
NULL);
gtk_widget_set_name (btn, "mux_icon_button_close");
g_signal_connect_swapped (btn, "clicked",
G_CALLBACK (mux_window_close_clicked), window);
gtk_box_pack_end (GTK_BOX (button_box), btn, FALSE, FALSE, 0);
gtk_widget_show (btn);
}
if (window->decorations & MUX_DECOR_SETTINGS) {
pixbuf = load_icon (window, "settings");
pixbuf_hover = load_icon (window, "settings_hover");
window->settings_button = g_object_new (MUX_TYPE_ICON_BUTTON,
"normal-state-pixbuf", pixbuf,
"prelight-state-pixbuf", pixbuf_hover,
"active-state-pixbuf", pixbuf_hover,
"toggleable", TRUE,
NULL);
gtk_widget_set_name (window->settings_button, "mux_icon_button_settings");
g_signal_connect (window->settings_button, "clicked",
G_CALLBACK (mux_window_settings_clicked), window);
gtk_box_pack_end (GTK_BOX (button_box), window->settings_button, FALSE, FALSE, 0);
gtk_widget_show (window->settings_button);
}
mux_window_update_style (window);
gtk_widget_map (window->title_bar); /*TODO: is there a better way to do this ? */
if (GTK_WIDGET_VISIBLE (window))
gtk_widget_queue_resize (GTK_WIDGET (window));
}
static void
mux_window_title_changed (MuxWindow *window,
GParamSpec *pspec,
gpointer user_data)
{
mux_window_build_title_bar (window);
}
/* For some reason metacity sometimes won't maximize but will if asked
* another time. For the record, I'm not proud of writing this */
static gboolean
mux_window_try_maximize (MuxWindow *self)
{
static int count = 0;
count++;
gtk_window_maximize (GTK_WINDOW (self));
return (count < 10);
}
static void
mux_window_init (MuxWindow *self)
{
self->decorations = MUX_DECOR_CLOSE;
gtk_window_set_decorated (GTK_WINDOW (self), FALSE);
g_signal_connect (self, "notify::title",
G_CALLBACK (mux_window_title_changed), NULL);
mux_window_build_title_bar (self);
self->notebook = gtk_notebook_new ();
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (self->notebook), FALSE);
gtk_notebook_set_show_border (GTK_NOTEBOOK (self->notebook), FALSE);
gtk_widget_set_parent (self->notebook, GTK_WIDGET (self));
self->settings_index = -2;
gtk_window_maximize (GTK_WINDOW (self));
g_timeout_add (10, (GSourceFunc)mux_window_try_maximize, self);
}
GtkWidget*
mux_window_new (const char *back_title)
{
return g_object_new (MUX_TYPE_WINDOW,
"back-title", back_title,
NULL);
}
void
mux_window_set_decorations (MuxWindow *window,
MuxDecorations decorations)
{
g_return_if_fail (MUX_IS_WINDOW (window));
if (decorations != window->decorations) {
window->decorations = decorations;
mux_window_build_title_bar (window);
}
}
MuxDecorations
mux_window_get_decorations (MuxWindow *window)
{
g_return_val_if_fail (MUX_IS_WINDOW (window), MUX_DECOR_NONE);
return window->decorations;
}
void
mux_window_set_settings_visible (MuxWindow *window, gboolean show)
{
gboolean visible;
visible = (mux_window_get_current_page (window) == window->settings_index);
if (visible != show) {
if (show) {
mux_window_set_current_page (window, window->settings_index);
} else {
mux_window_set_current_page (window, -1);
}
}
}
gboolean
mux_window_get_settings_visible (MuxWindow *window)
{
return (mux_window_get_current_page (window) == window->settings_index);
}
gint
mux_window_append_page (MuxWindow *window,
GtkWidget *page,
gboolean is_settings)
{
gint index;
index = gtk_notebook_append_page (GTK_NOTEBOOK (window->notebook), page, NULL);
if (is_settings) {
window->settings_index = index;
}
return index;
}
void mux_window_set_current_page (MuxWindow *window, gint index)
{
GtkBin *bin = GTK_BIN (window);
gint old_index = mux_window_get_current_page (window);
if (old_index == index) {
return;
}
if (index == -1) {
gtk_widget_hide (window->notebook);
if (bin->child) {
gtk_widget_show (bin->child);
}
gtk_widget_hide (window->back_btn);
} else {
gtk_notebook_set_current_page (GTK_NOTEBOOK (window->notebook), index);
if (bin->child) {
gtk_widget_hide (bin->child);
}
gtk_widget_show (window->notebook);
gtk_widget_map (window->notebook);
gtk_widget_show (window->back_btn);
}
if (window->settings_button) {
mux_icon_button_set_active (MUX_ICON_BUTTON (window->settings_button),
index == window->settings_index);
}
if (old_index == window->settings_index || index == window->settings_index) {
g_signal_emit (window, mux_window_signals[SETTINGS_VISIBILITY_CHANGED], 0);
}
}
gint
mux_window_get_current_page (MuxWindow *window)
{
GtkBin *bin = GTK_BIN (window);
if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) {
return -1;
} else if (window->notebook) {
return gtk_notebook_get_current_page (GTK_NOTEBOOK (window->notebook));
}
return -1;
}

View File

@ -1,92 +0,0 @@
/*
* Copyright (C) 2009 Intel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) version 3.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef _MUX_WINDOW
#define _MUX_WINDOW
#include <gtk/gtk.h>
G_BEGIN_DECLS
typedef enum {
MUX_DECOR_NONE = 0,
MUX_DECOR_CLOSE = 1 << 0,
MUX_DECOR_SETTINGS = 1 << 1,
} MuxDecorations;
GType mux_decorations_get_type (void) G_GNUC_CONST;
#define MUX_TYPE_DECORATIONS (mux_decorations_get_type())
#define MUX_TYPE_WINDOW mux_window_get_type()
#define MUX_WINDOW(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), MUX_TYPE_WINDOW, MuxWindow))
#define MUX_WINDOW_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), MUX_TYPE_WINDOW, MuxWindowClass))
#define MUX_IS_WINDOW(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), MUX_TYPE_WINDOW))
#define MUX_IS_WINDOW_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), MUX_TYPE_WINDOW))
#define MUX_WINDOW_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), MUX_TYPE_WINDOW, MuxWindowClass))
typedef struct {
GtkWindow parent;
GtkWidget *title_bar;
GtkWidget *back_btn;
GtkWidget *settings;
GtkWidget *settings_button;
GtkWidget *notebook;
gint settings_index;
GtkAllocation child_allocation;
MuxDecorations decorations;
GdkColor title_bar_color;
guint title_bar_height;
char *back_title;
} MuxWindow;
typedef struct {
GtkWindowClass parent_class;
void (*settings_visibility_changed) (MuxWindow *window);
} MuxWindowClass;
GType mux_window_get_type (void);
GtkWidget* mux_window_new (const char *back_title);
void mux_window_set_decorations (MuxWindow *window, MuxDecorations decorations);
MuxDecorations mux_window_get_decorations (MuxWindow *window);
void mux_window_set_settings_visible (MuxWindow *window, gboolean visible);
gboolean mux_window_get_settings_visible (MuxWindow *window);
gint mux_window_append_page (MuxWindow *window, GtkWidget *page, gboolean is_settings);
void mux_window_set_current_page (MuxWindow *window, gint index);
gint mux_window_get_current_page (MuxWindow *window);
G_END_DECLS
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -45,7 +45,6 @@
#ifdef USE_MOBLIN_UX
#include "mux-frame.h"
#include "mux-window.h"
#include <mx/mx-gtk.h>
#endif
@ -56,6 +55,12 @@ static gboolean support_canceling = FALSE;
#define STRING_VARIANT_HASHTABLE (dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE))
enum {
PAGE_MAIN,
PAGE_SETTINGS,
PAGE_EMERGENCY,
};
typedef enum bluetooth_type {
SYNC_BLUETOOTH_NONE,
SYNC_BLUETOOTH_GNOME,
@ -92,8 +97,10 @@ struct _app_data {
GtkWidget *services_win; /* will be NULL when USE_MOBLIN_UX is set*/
GtkWidget *emergency_win; /* will be NULL when USE_MOBLIN_UX is set*/
gint emergency_index; /* for use in mux_window_set_current_page() */
GtkWidget *notebook; /* only in use with USE_MOBLIN_UX */
GtkWidget *back_btn; /* only in use with USE_MOBLIN_UX */
GtkWidget *settings_btn; /* only in use with USE_MOBLIN_UX */
guint settings_id;
GtkWidget *service_box;
GtkWidget *info_bar;
@ -121,8 +128,8 @@ struct _app_data {
GtkWidget *services_box;
GtkWidget *devices_box;
GtkWidget *scrolled_window;
GtkWidget *back_btn;
GtkWidget *expanded_config;
GtkWidget *settings_close_btn;
GtkWidget *emergency_label;
GtkWidget *emergency_expander;
@ -130,6 +137,7 @@ struct _app_data {
GtkWidget *refresh_from_server_btn_label;
GtkWidget *refresh_from_client_btn_label;
GtkWidget *emergency_backup_table;
GtkWidget *emergency_close_btn;
GtkWidget *password_dialog_entry;
char *password_dialog_id;
@ -744,10 +752,6 @@ set_app_state (app_data *data, app_state state)
#ifdef USE_MOBLIN_UX
/* truly stupid, but glade doesn't allow custom containers.
Now glade file has dummy containers that will be replaced here.
The dummy should be a gtkbin and it's parent should be a box with just one child */
static GtkWidget*
switch_dummy_to_mux_frame (GtkWidget *dummy)
{
@ -768,81 +772,205 @@ switch_dummy_to_mux_frame (GtkWidget *dummy)
gtk_widget_reparent (gtk_bin_get_child (GTK_BIN (dummy)), frame);
gtk_container_remove (GTK_CONTAINER (parent), dummy);
/* make sure there are no other children in box */
g_assert (gtk_container_get_children (GTK_CONTAINER (parent)) == NULL);
gtk_box_pack_start (GTK_BOX (parent), frame, TRUE, TRUE, 0);
gtk_widget_show (frame);
return frame;
}
static void
set_page (app_data *data, int page)
{
int current = gtk_notebook_get_current_page (GTK_NOTEBOOK (data->notebook));
if (page != current) {
gtk_notebook_set_current_page (GTK_NOTEBOOK (data->notebook),
page);
if (page != PAGE_MAIN) {
gtk_widget_show (data->back_btn);
} else {
gtk_widget_hide (data->back_btn);
}
/* make sure the toggle is correct */
g_signal_handler_block (data->settings_btn, data->settings_id);
if (page == PAGE_SETTINGS) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->settings_btn),
TRUE);
} else if (current == PAGE_SETTINGS) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (data->settings_btn),
FALSE);
}
g_signal_handler_unblock (data->settings_btn, data->settings_id);
}
gtk_window_present (GTK_WINDOW (data->sync_win));
}
static void
settings_toggled (GtkToggleButton *button, app_data *data)
{
int page = gtk_notebook_get_current_page (GTK_NOTEBOOK (data->notebook));
if (page == PAGE_SETTINGS) {
show_main_view (data);
} else {
show_services_list (data, NULL);
}
}
static gboolean
key_press_cb (GtkWidget *widget,
GdkEventKey *event,
app_data *data)
{
if (event->keyval == GDK_Escape &&
mux_window_get_current_page (MUX_WINDOW (data->sync_win)) >= 0) {
int page = gtk_notebook_get_current_page (GTK_NOTEBOOK (data->notebook));
if (event->keyval == GDK_Escape && page != PAGE_MAIN) {
show_main_view (data);
}
return FALSE;
}
static void
settings_visibility_changed_cb (MuxWindow *win, app_data *data)
/* For some reason metacity sometimes won't maximize but will if asked
* another time. For the record, I'm not proud of writing this */
static gboolean
try_maximize (GtkWindow *win)
{
if (mux_window_get_settings_visible (MUX_WINDOW (data->sync_win))) {
update_services_list (data);
}
static int count = 0;
count++;
gtk_window_maximize (win);
return (count < 10);
}
static void
setup_windows (app_data *data,
GtkWidget *main,
GtkWidget *settings,
GtkWidget *emergency)
{
GtkWidget *mux_main;
GtkWidget *tmp;
GtkWidget *tmp, *toolbar, *close_btn;
GtkToolItem *item;
g_assert (GTK_IS_WINDOW (main));
g_assert (GTK_IS_WINDOW (settings));
g_assert (GTK_IS_WINDOW (emergency));
/* TRANSLATORS: button in the Moblin window title bar when main view is
* not visible */
mux_main = mux_window_new (_("Back to sync"));
gtk_window_set_title (GTK_WINDOW (mux_main),
gtk_window_get_title (GTK_WINDOW (main)));
gtk_window_set_default_size (GTK_WINDOW (mux_main), 1024, 600);
gtk_widget_set_name (mux_main, gtk_widget_get_name (main));
gtk_widget_reparent (gtk_bin_get_child (GTK_BIN (main)), mux_main);
mux_window_set_decorations (MUX_WINDOW (mux_main), MUX_DECOR_SETTINGS|MUX_DECOR_CLOSE);
g_signal_connect (mux_main, "key-press-event",
G_CALLBACK (key_press_cb), data);
g_signal_connect (mux_main, "settings-visibility-changed",
G_CALLBACK (settings_visibility_changed_cb), data);
data->sync_win = main;
data->services_win = NULL;
data->emergency_win = NULL;
/* populate the notebook with window contents */
data->notebook = gtk_notebook_new ();
gtk_widget_show (data->notebook);
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (data->notebook), FALSE);
gtk_notebook_set_show_border (GTK_NOTEBOOK (data->notebook), FALSE);
gtk_window_maximize (GTK_WINDOW (data->sync_win));
g_timeout_add (10, (GSourceFunc)try_maximize, data->sync_win);
gtk_window_set_decorated (GTK_WINDOW (data->sync_win), FALSE);
gtk_widget_set_name (data->sync_win, "meego_win");
g_signal_connect (data->sync_win, "key-press-event",
G_CALLBACK (key_press_cb), data);
tmp = g_object_ref (gtk_bin_get_child (GTK_BIN (data->sync_win)));
gtk_container_remove (GTK_CONTAINER (data->sync_win), tmp);
gtk_notebook_append_page (GTK_NOTEBOOK (data->notebook), tmp, NULL);
g_object_unref (tmp);
tmp = g_object_ref (gtk_bin_get_child (GTK_BIN (settings)));
gtk_container_remove (GTK_CONTAINER (settings), tmp);
mux_window_append_page (MUX_WINDOW (mux_main), tmp, TRUE);
gtk_notebook_append_page (GTK_NOTEBOOK (data->notebook), tmp, NULL);
g_object_unref (tmp);
tmp = g_object_ref (gtk_bin_get_child (GTK_BIN (emergency)));
gtk_container_remove (GTK_CONTAINER (emergency), tmp);
data->emergency_index =
mux_window_append_page (MUX_WINDOW (mux_main), tmp, FALSE);
gtk_notebook_append_page (GTK_NOTEBOOK (data->notebook), tmp, NULL);
g_object_unref (tmp);
data->sync_win = mux_main;
data->services_win = NULL;
data->emergency_win = NULL;
tmp = gtk_vbox_new (FALSE, 0);
gtk_widget_show (tmp);
gtk_container_add (GTK_CONTAINER (data->sync_win), tmp);
gtk_box_pack_end (GTK_BOX (tmp), data->notebook,
TRUE, TRUE, 0);
/* create the window toolbar */
toolbar = gtk_toolbar_new ();
gtk_widget_set_name (toolbar, "MeeGoToolbar");
gtk_box_pack_start (GTK_BOX (tmp), toolbar,
FALSE, FALSE, 0);
data->back_btn = gtk_button_new_with_label (_("Back to sync"));
gtk_widget_set_can_focus (data->back_btn, FALSE);
gtk_widget_set_no_show_all (data->back_btn, TRUE);
g_signal_connect_swapped (data->back_btn, "clicked",
G_CALLBACK (show_main_view), data);
item = gtk_tool_item_new ();
gtk_container_add (GTK_CONTAINER (item), data->back_btn);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 0);
item = gtk_separator_tool_item_new ();
gtk_tool_item_set_expand (item, TRUE);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, 1);
data->settings_btn = gtk_toggle_button_new ();
gtk_widget_set_can_focus (data->settings_btn, FALSE);
gtk_widget_set_name (data->settings_btn, "MeeGoSettingsButton");
data->settings_id = g_signal_connect (data->settings_btn, "toggled",
G_CALLBACK (settings_toggled), data);
gtk_container_add (GTK_CONTAINER (data->settings_btn),
gtk_image_new_from_icon_name ("preferences-other-hover",
GTK_ICON_SIZE_DIALOG));
item = gtk_tool_item_new ();
gtk_container_add (GTK_CONTAINER (item), data->settings_btn);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
close_btn = gtk_button_new ();
gtk_widget_set_can_focus (close_btn, FALSE);
gtk_widget_set_name (close_btn, "MeeGoCloseButton");
g_signal_connect (close_btn, "clicked",
G_CALLBACK (gtk_main_quit), NULL);
gtk_container_add (GTK_CONTAINER (close_btn),
gtk_image_new_from_icon_name ("window-close-hover",
GTK_ICON_SIZE_DIALOG));
item = gtk_tool_item_new ();
gtk_container_add (GTK_CONTAINER (item), close_btn);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
gtk_widget_show_all (toolbar);
/* no need for close buttons */
gtk_widget_hide (data->settings_close_btn);
gtk_widget_hide (data->emergency_close_btn);
}
static void
show_emergency_view (app_data *data)
{
update_emergency_view (data);
set_page (data, PAGE_EMERGENCY);
}
static void
show_services_list (app_data *data, const char *config_id_to_open)
{
g_free (data->config_id_to_open);
data->config_id_to_open = g_strdup (config_id_to_open);
set_page (data, PAGE_SETTINGS);
update_services_list (data);
}
static void
show_main_view (app_data *data)
{
set_page (data, PAGE_MAIN);
}
#else
@ -869,6 +997,34 @@ setup_windows (app_data *data,
g_signal_connect (data->emergency_win, "delete-event",
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
}
static void
show_emergency_view (app_data *data)
{
update_emergency_view (data);
gtk_widget_hide (data->services_win);
gtk_window_present (GTK_WINDOW (data->emergency_win));
}
static void
show_services_list (app_data *data, const char *config_id_to_open)
{
g_free (data->config_id_to_open);
data->config_id_to_open = g_strdup (config_id_to_open);
gtk_widget_hide (data->emergency_win);
gtk_window_present (GTK_WINDOW (data->services_win));
update_services_list (data);
}
static void
show_main_view (app_data *data)
{
gtk_widget_hide (data->services_win);
gtk_widget_hide (data->emergency_win);
gtk_window_present (GTK_WINDOW (data->sync_win));
}
#endif
/* This is a hacky way to achieve autoscrolling when the expanders open/close */
@ -1146,8 +1302,7 @@ init_ui (app_data *data)
G_CALLBACK (services_box_allocate_cb), data);
data->devices_box = GTK_WIDGET (gtk_builder_get_object (builder, "devices_box"));
data->back_btn = GTK_WIDGET (gtk_builder_get_object (builder, "back_btn"));
data->settings_close_btn = GTK_WIDGET (gtk_builder_get_object (builder, "settings_close_btn"));
/* emergency view */
btn = GTK_WIDGET (gtk_builder_get_object (builder, "slow_sync_btn"));
@ -1164,6 +1319,7 @@ init_ui (app_data *data)
data->emergency_expander = GTK_WIDGET (gtk_builder_get_object (builder, "emergency_expander"));
data->emergency_source_table = GTK_WIDGET (gtk_builder_get_object (builder, "emergency_source_table"));
data->emergency_backup_table = GTK_WIDGET (gtk_builder_get_object (builder, "emergency_backup_table"));
data->emergency_close_btn = GTK_WIDGET (gtk_builder_get_object (builder, "emergency_close_btn"));
/* No (documented) way to add own widgets to gtkbuilder it seems...
swap the all dummy widgets with Muxwidgets */
@ -1185,6 +1341,12 @@ init_ui (app_data *data)
G_CALLBACK (emergency_clicked_cb), data);
g_signal_connect (data->sync_btn, "clicked",
G_CALLBACK (sync_clicked_cb), data);
g_signal_connect_swapped (data->emergency_close_btn, "clicked",
G_CALLBACK (show_main_view), data);
g_signal_connect_swapped (data->settings_close_btn, "clicked",
G_CALLBACK (show_main_view), data);
g_signal_connect (data->emergency_btn, "clicked",
G_CALLBACK (emergency_clicked_cb), data);
data->new_device_btn = GTK_WIDGET (gtk_builder_get_object (builder, "new_device_btn"));
g_signal_connect (data->new_device_btn, "clicked",
@ -2954,46 +3116,6 @@ start_session_cb (SyncevoServer *server,
g_free (path);
}
static void
show_emergency_view (app_data *data)
{
update_emergency_view (data);
#ifdef USE_MOBLIN_UX
mux_window_set_current_page (MUX_WINDOW (data->sync_win),
data->emergency_index);
#else
gtk_widget_hide (data->services_win);
gtk_window_present (GTK_WINDOW (data->emergency_win));
#endif
}
static void
show_services_list (app_data *data, const char *config_id_to_open)
{
g_free (data->config_id_to_open);
data->config_id_to_open = g_strdup (config_id_to_open);
#ifdef USE_MOBLIN_UX
mux_window_set_settings_visible (MUX_WINDOW (data->sync_win), TRUE);
#else
gtk_widget_hide (data->emergency_win);
gtk_window_present (GTK_WINDOW (data->services_win));
update_services_list (data);
#endif
}
static void
show_main_view (app_data *data)
{
#ifdef USE_MOBLIN_UX
mux_window_set_current_page (MUX_WINDOW (data->sync_win), -1);
#else
gtk_widget_hide (data->services_win);
gtk_widget_hide (data->emergency_win);
#endif
gtk_window_present (GTK_WINDOW (data->sync_win));
}
/* TODO: this function should accept source/peer name as param */
char*
get_error_string_for_code (int error_code, SyncErrorResponse *response)

View File

@ -1,12 +1,5 @@
# generic rules for MuxWidgets
style "mux-win" {
bg[NORMAL] = "#4a535a"
MuxWindow::title-bar-bg = "#333333"
MuxWindow::title-bar-fg = "#c2c2c2"
}
class "MuxWindow" style "mux-win"
style "mux-frame" {
bg[NORMAL] = "#ffffff"
bg[INSENSITIVE] = "#ffffff"
@ -18,6 +11,11 @@ class "MuxFrame" style "mux-frame"
# sync-ui specific rules
style "meego-win" {
bg[NORMAL] = "#4a535a"
}
widget "meego_win" style "meego-win"
style "data-box" {
bg[NORMAL] = "#ececec"
bg[INSENSITIVE] = "#ececec"

View File

@ -4,314 +4,43 @@
<!-- interface-naming-policy toplevel-contextual -->
<widget class="GtkWindow" id="sync_win">
<property name="width_request">1024</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Sync</property>
<property name="default_width">800</property>
<property name="default_height">550</property>
<child>
<widget class="GtkHBox" id="hbox2">
<widget class="GtkVBox" id="window_child">
<property name="visible">True</property>
<property name="spacing">5</property>
<child>
<widget class="GtkVBox" id="vbox2">
<widget class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="border_width">4</property>
<property name="spacing">4</property>
<child>
<widget class="GtkFrame" id="main_frame">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<widget class="GtkVBox" id="main_box">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<child>
<widget class="GtkHBox" id="server_icon_box">
<property name="width_request">48</property>
<property name="height_request">48</property>
<property name="visible">True</property>
<child>
<widget class="GtkImage" id="sync_service_image">
<property name="visible">True</property>
<property name="stock">gtk-missing-image</property>
<property name="icon-size">6</property>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">10</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="sync_service_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="yalign">0.20000000298023224</property>
<property name="use_markup">True</property>
<property name="ellipsize">end</property>
<property name="max_width_chars">42</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">5</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="autosync_box">
<property name="visible">True</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<property name="spacing">4</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">8</property>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">16</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox5">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkEventBox" id="sync_data_and_type_box">
<property name="visible">True</property>
<child>
<widget class="GtkVBox" id="vbox15">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkHBox" id="hbox15">
<property name="visible">True</property>
<child>
<widget class="GtkVBox" id="vbox16">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkHBox" id="service_error_box">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="service_box">
<property name="orientation">vertical</property>
<child>
<widget class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="top_padding">5</property>
<property name="left_padding">12</property>
<child>
<widget class="GtkVBox" id="sources_box">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</widget>
</child>
</widget>
</child>
<child>
<placeholder/>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">55</property>
<property name="position">0</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">6</property>
<property name="position">0</property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label13">
<property name="visible">True</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox3">
<property name="width_request">250</property>
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<widget class="GtkVBox" id="vbox9">
<widget class="GtkVBox" id="vbox2">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkFrame" id="log_frame">
<widget class="GtkFrame" id="main_frame">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">in</property>
<property name="shadow_type">none</property>
<child>
<widget class="GtkVBox" id="vbox18">
<widget class="GtkVBox" id="main_box">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkVBox" id="vbox10">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkHBox" id="hbox7">
<property name="visible">True</property>
<child>
<widget class="GtkLabel" id="sync_status_label">
<property name="visible">True</property>
<property name="xalign">0</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">6</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="spinner_box">
<property name="height_request">24</property>
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkImage" id="spinner_image">
<property name="visible">True</property>
<property name="stock">gtk-missing-image</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">10</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox20">
<widget class="GtkHBox" id="hbox3">
<property name="visible">True</property>
<child>
<widget class="GtkVBox" id="info_box">
<widget class="GtkHBox" id="server_icon_box">
<property name="width_request">48</property>
<property name="height_request">48</property>
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkHBox" id="no_connection_box">
<child>
<placeholder/>
</child>
<widget class="GtkImage" id="sync_service_image">
<property name="visible">True</property>
<property name="stock">gtk-missing-image</property>
<property name="icon-size">6</property>
</widget>
<packing>
<property name="position">0</property>
@ -320,126 +49,172 @@
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">5</property>
<property name="padding">10</property>
<property name="position">0</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">5</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox17">
<property name="height_request">25</property>
<property name="visible">True</property>
<child>
<widget class="GtkProgressBar" id="progressbar">
<property name="text_xalign">0.029999999329447746</property>
<widget class="GtkLabel" id="sync_service_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="yalign">0.20000000298023224</property>
<property name="use_markup">True</property>
<property name="ellipsize">end</property>
<property name="max_width_chars">42</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">5</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="autosync_box">
<property name="visible">True</property>
<property name="border_width">6</property>
<property name="orientation">vertical</property>
<property name="spacing">4</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">8</property>
<property name="pack_type">end</property>
<property name="position">0</property>
<property name="position">2</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
<property name="padding">16</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox6">
<widget class="GtkVBox" id="vbox5">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkVBox" id="vbox8">
<widget class="GtkEventBox" id="sync_data_and_type_box">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
<widget class="GtkLabel" id="action_label">
<widget class="GtkVBox" id="vbox15">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" comments="title for the buttons on the right side of main view">&lt;b&gt;Actions&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="sync_btn">
<property name="label">Sync now</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</widget>
<packing>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="change_service_btn">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkLabel" id="label15">
<widget class="GtkHBox" id="hbox15">
<property name="visible">True</property>
<property name="label" translatable="yes" comments="Button in main view, right side. Keep to below 20 chars per line, feel free to use two lines">Change or edit
sync service</property>
<property name="justify">center</property>
<child>
<widget class="GtkVBox" id="vbox16">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkHBox" id="service_error_box">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="service_box">
<property name="orientation">vertical</property>
<child>
<widget class="GtkFrame" id="frame2">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">none</property>
<child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="top_padding">5</property>
<property name="left_padding">12</property>
<child>
<widget class="GtkVBox" id="sources_box">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</widget>
</child>
</widget>
</child>
<child>
<placeholder/>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">55</property>
<property name="position">0</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">6</property>
<property name="position">0</property>
</packing>
</child>
</widget>
<packing>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="emergency_btn">
<property name="label" translatable="yes" comments="button in main view, right side. Keep length to 20 characters or so, use two lines if needed">Fix a sync
emergency</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">30</property>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">20</property>
<property name="position">3</property>
<property name="position">1</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label18">
<widget class="GtkLabel" id="label13">
<property name="visible">True</property>
<property name="use_markup">True</property>
</widget>
@ -457,11 +232,244 @@ emergency</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox3">
<property name="width_request">250</property>
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<widget class="GtkVBox" id="vbox9">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkFrame" id="log_frame">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">in</property>
<child>
<widget class="GtkVBox" id="vbox18">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkVBox" id="vbox10">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkHBox" id="hbox7">
<property name="visible">True</property>
<child>
<widget class="GtkLabel" id="sync_status_label">
<property name="visible">True</property>
<property name="xalign">0</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">6</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="spinner_box">
<property name="height_request">24</property>
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkImage" id="spinner_image">
<property name="visible">True</property>
<property name="stock">gtk-missing-image</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">10</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox20">
<property name="visible">True</property>
<child>
<widget class="GtkVBox" id="info_box">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkHBox" id="no_connection_box">
<child>
<placeholder/>
</child>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">5</property>
<property name="position">0</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">5</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox17">
<property name="height_request">25</property>
<property name="visible">True</property>
<child>
<widget class="GtkProgressBar" id="progressbar">
<property name="text_xalign">0.029999999329447746</property>
<property name="ellipsize">end</property>
</widget>
<packing>
<property name="padding">5</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox6">
<property name="visible">True</property>
<child>
<widget class="GtkVBox" id="vbox8">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
<widget class="GtkLabel" id="action_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes" comments="title for the buttons on the right side of main view">&lt;b&gt;Actions&lt;/b&gt;</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="sync_btn">
<property name="label">Sync now</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</widget>
<packing>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="change_service_btn">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<child>
<widget class="GtkLabel" id="label15">
<property name="visible">True</property>
<property name="label" translatable="yes" comments="Button in main view, right side. Keep to below 20 chars per line, feel free to use two lines">Change or edit
sync service</property>
<property name="justify">center</property>
</widget>
</child>
</widget>
<packing>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="emergency_btn">
<property name="label" translatable="yes" comments="button in main view, right side. Keep length to 20 characters or so, use two lines if needed">Fix a sync
emergency</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">30</property>
<property name="position">0</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">20</property>
<property name="position">3</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</widget>
</child>
<child>
<widget class="GtkLabel" id="label18">
<property name="visible">True</property>
<property name="use_markup">True</property>
</widget>
<packing>
<property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
</widget>
<packing>
<property name="position">0</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">1</property>
<property name="position">0</property>
</packing>
</child>
</widget>
@ -479,6 +487,7 @@ emergency</property>
<child>
<widget class="GtkVBox" id="vbox6">
<property name="visible">True</property>
<property name="border_width">4</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkFrame" id="services_list_frame">
@ -750,6 +759,29 @@ you can setup a service manually.</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="settings_close_box">
<property name="visible">True</property>
<child>
<widget class="GtkButton" id="settings_close_btn">
<property name="label" translatable="yes" comments="close button for settings window">Close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">12</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
</widget>
@ -765,6 +797,7 @@ you can setup a service manually.</property>
<child>
<widget class="GtkVBox" id="vbox14">
<property name="visible">True</property>
<property name="border_width">4</property>
<property name="orientation">vertical</property>
<child>
<widget class="GtkFrame" id="emergency_frame">
@ -1272,6 +1305,29 @@ local information</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="emergency_close_box">
<property name="visible">True</property>
<child>
<widget class="GtkButton" id="emergency_close_btn">
<property name="label" translatable="yes" comments="close button for settings window">Close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="padding">12</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
</child>
</widget>