[gnome-builder] Standardize the usage of GB_WIDGET_CLASS_* macros
- From: Fabiano Fidêncio <ffidencio src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] Standardize the usage of GB_WIDGET_CLASS_* macros
- Date: Fri, 26 Dec 2014 21:00:44 +0000 (UTC)
commit df4071e17b0c579b23ef0dafdc47cf17c6304c52
Author: Fabiano Fidêncio <fidencio redhat com>
Date: Fri Dec 26 16:55:47 2014 +0100
Standardize the usage of GB_WIDGET_CLASS_* macros
klass can always be used instead of widget_class, as the casting will
be done in the registration macros.
src/credits/gb-credits-widget.c | 9 ++++-----
src/editor/gb-editor-frame.c | 18 +++++++++---------
src/editor/gb-editor-settings-widget.c | 29 ++++++++++++++---------------
src/editor/gb-editor-tweak-widget.c | 7 +++----
src/editor/gb-editor-view.c | 28 ++++++++++++++--------------
src/search/gb-search-display.c | 6 +++---
src/util/gb-widget.h | 4 ++--
7 files changed, 49 insertions(+), 52 deletions(-)
---
diff --git a/src/credits/gb-credits-widget.c b/src/credits/gb-credits-widget.c
index 1928fca..1dd0581 100644
--- a/src/credits/gb-credits-widget.c
+++ b/src/credits/gb-credits-widget.c
@@ -253,7 +253,6 @@ gb_credits_widget_set_property (GObject *object,
static void
gb_credits_widget_class_init (GbCreditsWidgetClass *klass)
{
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkOverlayClass *overlay_class = GTK_OVERLAY_CLASS (klass);
@@ -285,10 +284,10 @@ gb_credits_widget_class_init (GbCreditsWidgetClass *klass)
g_object_class_install_property (object_class, PROP_PROGRESS,
gParamSpecs [PROP_PROGRESS]);
- GB_WIDGET_CLASS_TEMPLATE (widget_class, "gb-credits-widget.ui");
- GB_WIDGET_CLASS_BIND (widget_class, GbCreditsWidget, title);
- GB_WIDGET_CLASS_BIND (widget_class, GbCreditsWidget, grid);
- GB_WIDGET_CLASS_BIND (widget_class, GbCreditsWidget, event_box);
+ GB_WIDGET_CLASS_TEMPLATE (klass, "gb-credits-widget.ui");
+ GB_WIDGET_CLASS_BIND (klass, GbCreditsWidget, title);
+ GB_WIDGET_CLASS_BIND (klass, GbCreditsWidget, grid);
+ GB_WIDGET_CLASS_BIND (klass, GbCreditsWidget, event_box);
}
static void
diff --git a/src/editor/gb-editor-frame.c b/src/editor/gb-editor-frame.c
index 125b503..48c9f6f 100644
--- a/src/editor/gb-editor-frame.c
+++ b/src/editor/gb-editor-frame.c
@@ -1253,15 +1253,15 @@ gb_editor_frame_class_init (GbEditorFrameClass *klass)
G_TYPE_NONE,
0);
- GB_WIDGET_CLASS_TEMPLATE (widget_class, "gb-editor-frame.ui");
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorFrame, busy_spinner);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorFrame, floating_bar);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorFrame, forward_search);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorFrame, backward_search);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorFrame, scrolled_window);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorFrame, search_revealer);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorFrame, search_entry);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorFrame, source_view);
+ GB_WIDGET_CLASS_TEMPLATE (klass, "gb-editor-frame.ui");
+ GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, busy_spinner);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, floating_bar);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, forward_search);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, backward_search);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, scrolled_window);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, search_revealer);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, search_entry);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, source_view);
g_type_ensure (GB_TYPE_SOURCE_VIEW);
g_type_ensure (GD_TYPE_TAGGED_ENTRY);
diff --git a/src/editor/gb-editor-settings-widget.c b/src/editor/gb-editor-settings-widget.c
index 93d465e..994bff8 100644
--- a/src/editor/gb-editor-settings-widget.c
+++ b/src/editor/gb-editor-settings-widget.c
@@ -182,26 +182,25 @@ static void
gb_editor_settings_widget_class_init (GbEditorSettingsWidgetClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->finalize = gb_editor_settings_widget_finalize;
object_class->get_property = gb_editor_settings_widget_get_property;
object_class->set_property = gb_editor_settings_widget_set_property;
- GB_WIDGET_CLASS_TEMPLATE (widget_class, "gb-editor-settings-widget.ui");
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorSettingsWidget, auto_indent);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorSettingsWidget, highlight_current_line);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorSettingsWidget, highlight_matching_brackets);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorSettingsWidget, insert_matching_brace);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorSettingsWidget, insert_spaces_instead_of_tabs);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorSettingsWidget, right_margin_position);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorSettingsWidget, overwrite_braces);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorSettingsWidget, show_line_marks);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorSettingsWidget, show_line_numbers);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorSettingsWidget, show_right_margin);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorSettingsWidget, smart_home_end);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorSettingsWidget, tab_width);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorSettingsWidget, trim_trailing_whitespace);
+ GB_WIDGET_CLASS_TEMPLATE (klass, "gb-editor-settings-widget.ui");
+ GB_WIDGET_CLASS_BIND (klass, GbEditorSettingsWidget, auto_indent);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorSettingsWidget, highlight_current_line);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorSettingsWidget, highlight_matching_brackets);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorSettingsWidget, insert_matching_brace);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorSettingsWidget, insert_spaces_instead_of_tabs);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorSettingsWidget, right_margin_position);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorSettingsWidget, overwrite_braces);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorSettingsWidget, show_line_marks);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorSettingsWidget, show_line_numbers);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorSettingsWidget, show_right_margin);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorSettingsWidget, smart_home_end);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorSettingsWidget, tab_width);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorSettingsWidget, trim_trailing_whitespace);
gParamSpecs [PROP_LANGUAGE] =
g_param_spec_string ("language",
diff --git a/src/editor/gb-editor-tweak-widget.c b/src/editor/gb-editor-tweak-widget.c
index 8747ab3..3cf3c69 100644
--- a/src/editor/gb-editor-tweak-widget.c
+++ b/src/editor/gb-editor-tweak-widget.c
@@ -182,13 +182,12 @@ static void
gb_editor_tweak_widget_class_init (GbEditorTweakWidgetClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->constructed = gb_editor_tweak_widget_constructed;
- GB_WIDGET_CLASS_TEMPLATE (widget_class, "gb-editor-tweak-widget.ui");
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorTweakWidget, entry);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorTweakWidget, list_box);
+ GB_WIDGET_CLASS_TEMPLATE (klass, "gb-editor-tweak-widget.ui");
+ GB_WIDGET_CLASS_BIND (klass, GbEditorTweakWidget, entry);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorTweakWidget, list_box);
gLangQuark = g_quark_from_static_string ("GtkSourceLanguage");
}
diff --git a/src/editor/gb-editor-view.c b/src/editor/gb-editor-view.c
index 481a2d1..749515a 100644
--- a/src/editor/gb-editor-view.c
+++ b/src/editor/gb-editor-view.c
@@ -992,20 +992,20 @@ gb_editor_view_class_init (GbEditorViewClass *klass)
g_object_class_install_property (object_class, PROP_USE_SPACES,
gParamSpecs [PROP_USE_SPACES]);
- GB_WIDGET_CLASS_TEMPLATE (widget_class, "gb-editor-view.ui");
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorView, frame);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorView, paned);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorView, progress_bar);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorView, split_button);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorView, tweak_button);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorView, tweak_widget);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorView, modified_revealer);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorView, modified_label);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorView, modified_cancel_button);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorView, modified_reload_button);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorView, error_label);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorView, error_revealer);
- GB_WIDGET_CLASS_BIND (widget_class, GbEditorView, error_close_button);
+ GB_WIDGET_CLASS_TEMPLATE (klass, "gb-editor-view.ui");
+ GB_WIDGET_CLASS_BIND (klass, GbEditorView, frame);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorView, paned);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorView, progress_bar);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorView, split_button);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorView, tweak_button);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorView, tweak_widget);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorView, modified_revealer);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorView, modified_label);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorView, modified_cancel_button);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorView, modified_reload_button);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorView, error_label);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorView, error_revealer);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorView, error_close_button);
g_type_ensure (GB_TYPE_EDITOR_FRAME);
g_type_ensure (GB_TYPE_EDITOR_TWEAK_WIDGET);
diff --git a/src/search/gb-search-display.c b/src/search/gb-search-display.c
index 5541951..af16d71 100644
--- a/src/search/gb-search-display.c
+++ b/src/search/gb-search-display.c
@@ -392,9 +392,9 @@ gb_search_display_class_init (GbSearchDisplayClass *klass)
1,
GB_TYPE_SEARCH_RESULT);
- GB_WIDGET_CLASS_TEMPLATE (widget_class, "gb-search-display.ui");
- GB_WIDGET_CLASS_BIND (widget_class, GbSearchDisplay, list_box);
- GB_WIDGET_CLASS_BIND (widget_class, GbSearchDisplay, scroller);
+ GB_WIDGET_CLASS_TEMPLATE (klass, "gb-search-display.ui");
+ GB_WIDGET_CLASS_BIND (klass, GbSearchDisplay, list_box);
+ GB_WIDGET_CLASS_BIND (klass, GbSearchDisplay, scroller);
g_type_ensure (GB_TYPE_SCROLLED_WINDOW);
}
diff --git a/src/util/gb-widget.h b/src/util/gb-widget.h
index 904d874..cfda6c3 100644
--- a/src/util/gb-widget.h
+++ b/src/util/gb-widget.h
@@ -26,10 +26,10 @@
G_BEGIN_DECLS
#define GB_WIDGET_CLASS_TEMPLATE(klass, name) \
- gtk_widget_class_set_template_from_resource((GtkWidgetClass*)klass, \
+ gtk_widget_class_set_template_from_resource(GTK_WIDGET_CLASS (klass), \
"/org/gnome/builder/ui/"name)
#define GB_WIDGET_CLASS_BIND(klass, TN, field) \
- gtk_widget_class_bind_template_child_private ((GtkWidgetClass*)klass, \
+ gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), \
TN, field)
void gb_widget_add_style_class (gpointer widget,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]