Commit df4071e1 authored by Fabiano Fidêncio's avatar Fabiano Fidêncio
Browse files

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.
parent 598f01bc
......@@ -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
......
......@@ -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);
......
......@@ -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",
......
......@@ -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");
}
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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,
......
Markdown is supported
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