Commit a7519f83 authored by Bastien Nocera's avatar Bastien Nocera
Browse files

region: Remove useless level of indirection

Clean up that mess of a code somewhat.
parent 5db534af
......@@ -17,8 +17,6 @@ libregion_la_SOURCES = \
region-module.c \
cc-region-panel.c \
cc-region-panel.h \
gnome-region-panel.c \
gnome-region-panel.h \
gnome-region-panel-xkb.c \
gnome-region-panel-xkbmc.c \
gnome-region-panel-xkblt.c \
......
......@@ -22,9 +22,14 @@
#include "cc-region-panel.h"
#include <gtk/gtk.h>
#include "gnome-region-panel-xkb.h"
#define WID(s) GTK_WIDGET (gtk_builder_get_object (dialog, s))
G_DEFINE_DYNAMIC_TYPE (CcRegionPanel, cc_region_panel, CC_TYPE_PANEL)
#define REGION_PANEL_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_REGION_PANEL, CcRegionPanelPrivate))
#define REGION_PANEL_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_REGION_PANEL, CcRegionPanelPrivate))
struct _CcRegionPanelPrivate {
GtkBuilder *builder;
};
......@@ -91,7 +96,21 @@ cc_region_panel_class_finalize (CcRegionPanelClass * klass)
{
}
GtkWidget *gnome_region_properties_init (GtkBuilder * dialog);
static void
setup_images (GtkBuilder * dialog)
{
GtkWidget *image;
image =
gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON);
gtk_button_set_image (GTK_BUTTON (WID ("xkb_layouts_add")), image);
image =
gtk_image_new_from_stock (GTK_STOCK_REFRESH,
GTK_ICON_SIZE_BUTTON);
gtk_button_set_image (GTK_BUTTON (WID ("xkb_reset_to_defaults")),
image);
}
static void
cc_region_panel_init (CcRegionPanel * self)
......@@ -113,10 +132,12 @@ cc_region_panel_init (CcRegionPanel * self)
return;
}
gnome_region_properties_init (priv->builder);
setup_images (priv->builder);
setup_xkb_tabs (priv->builder);
prefs_widget = (GtkWidget *) gtk_builder_get_object (priv->builder,
"region_notebook");
gtk_widget_set_size_request (GTK_WIDGET (prefs_widget), -1, 400);
gtk_widget_reparent (prefs_widget, GTK_WIDGET (self));
}
......
/* keyboard-properties.c
* Copyright (C) 2000-2001 Ximian, Inc.
* Copyright (C) 2001 Jonathan Blandford
*
* Written by: Bradford Hovinen <hovinen@ximian.com>
* Rachel Hestilow <hestilow@ximian.com>
* Jonathan Blandford <jrb@redhat.com>
* Rodrigo Moya <rodrigo@gnome.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gio/gio.h>
#include "gnome-region-panel.h"
#include "gnome-region-panel-xkb.h"
enum {
RESPONSE_APPLY = 1,
RESPONSE_CLOSE
};
#define WID(s) GTK_WIDGET (gtk_builder_get_object (dialog, s))
static void
create_dialog (GtkBuilder * dialog)
{
GtkWidget *image;
image =
gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_BUTTON);
gtk_button_set_image (GTK_BUTTON (WID ("xkb_layouts_add")), image);
image =
gtk_image_new_from_stock (GTK_STOCK_REFRESH,
GTK_ICON_SIZE_BUTTON);
gtk_button_set_image (GTK_BUTTON (WID ("xkb_reset_to_defaults")),
image);
}
static void
setup_dialog (GtkBuilder * dialog)
{
setup_xkb_tabs (dialog);
}
GtkWidget *
gnome_region_properties_init (GtkBuilder * dialog)
{
GtkWidget *region_notebook = NULL;
create_dialog (dialog);
if (dialog) {
setup_dialog (dialog);
region_notebook = WID ("region_notebook");
gtk_widget_set_size_request (GTK_WIDGET (region_notebook), -1, 400);
}
return region_notebook;
}
/* keyboard-properties.c
* Copyright (C) 2000-2001 Ximian, Inc.
* Copyright (C) 2001 Jonathan Blandford
*
* Written by: Bradford Hovinen <hovinen@ximian.com>
* Rachel Hestilow <hestilow@ximian.com>
* Jonathan Blandford <jrb@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#include <gtk/gtk.h>
GtkWidget *gnome_region_properties_init (GtkBuilder * dialog);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment