diff --git a/src/libide/gui/ide-preferences-builtin.c b/src/libide/gui/ide-preferences-builtin.c index e7816243662fc695d7b8042208b788b001e7d15e..86e6766db27fd7751927b06aaff29f2ef183ac4e 100644 --- a/src/libide/gui/ide-preferences-builtin.c +++ b/src/libide/gui/ide-preferences-builtin.c @@ -667,6 +667,7 @@ static const IdePreferencePageEntry pages[] = { static const IdePreferencePageEntry project_pages[] = { { NULL, "config", "configurations", "org.gnome.Builder-projects-symbolic", 0, N_("Configurations") }, { NULL, "code", "languages", "org.gnome.Builder-languages-symbolic", 100, N_("Languages") }, + { NULL, "tools", "build", "org.gnome.Builder-build-symbolic", 300, N_("Build") }, }; static const IdePreferenceGroupEntry groups[] = { @@ -720,17 +721,17 @@ static const IdePreferenceItemEntry items[] = { { "debug", "breakpoints", "break-on-main", 0, ide_preferences_window_toggle, N_("Break on Main"), - N_("Automatically insert a breakpoint at the start of teh application"), + N_("Automatically insert a breakpoint at the start of the application"), "org.gnome.builder.build", NULL, "debugger-breakpoint-on-main" }, { "build", "general", "clear-build-logs", 10, ide_preferences_window_toggle, N_("Clear Build Logs"), - N_("Upon rebulding the project the build log will be cleared"), + N_("Upon rebuilding the project the build log will be cleared"), "org.gnome.builder.build", NULL, "clear-build-log-pane" }, { "build", "general", "clear-build-cache", 20, ide_preferences_window_toggle, N_("Clear Expired Artifacts"), - N_("Artifcats which have expired will be deleted when Builder is started"), + N_("Artifacts which have expired will be deleted when Builder is started"), "org.gnome.builder", NULL, "clear-cache-at-startup" }, { "network", "downloads", "metered", 0, ide_preferences_window_toggle, diff --git a/src/libide/gui/ide-preferences-window.c b/src/libide/gui/ide-preferences-window.c index 36acecdf9b29736b6705ffd8f94c3f548f095f34..f9d0bea6bf1fe2d8b662d88dd3721059660d5602 100644 --- a/src/libide/gui/ide-preferences-window.c +++ b/src/libide/gui/ide-preferences-window.c @@ -1419,7 +1419,6 @@ ide_preferences_window_spin (const char *page_name, IdePreferencesWindow *self = user_data; g_autofree char *title_esc = NULL; g_autofree char *subtitle_esc = NULL; - g_autoptr(GError) error = NULL; GtkAdjustment *adj = NULL; AdwActionRow *row; GtkWidget *child; diff --git a/src/plugins/buildui/buildui-plugin.c b/src/plugins/buildui/buildui-plugin.c index 33f4f8c88d13ae441154cb5974595120773e6f0c..4930e19338c6f1aab7b04a7cd3066d8997039984 100644 --- a/src/plugins/buildui/buildui-plugin.c +++ b/src/plugins/buildui/buildui-plugin.c @@ -28,7 +28,8 @@ #include //#include "gbp-buildui-config-view-addin.h" -//#include "gbp-buildui-editor-page-addin.h" +#include "gbp-buildui-editor-page-addin.h" +#include "gbp-buildui-preferences-addin.h" #include "gbp-buildui-workspace-addin.h" #include "gbp-buildui-tree-addin.h" @@ -39,10 +40,13 @@ _gbp_buildui_register_types (PeasObjectModule *module) peas_object_module_register_extension_type (module, IDE_TYPE_CONFIG_VIEW_ADDIN, GBP_TYPE_BUILDUI_CONFIG_VIEW_ADDIN); +#endif peas_object_module_register_extension_type (module, IDE_TYPE_EDITOR_PAGE_ADDIN, GBP_TYPE_BUILDUI_EDITOR_PAGE_ADDIN); -#endif + peas_object_module_register_extension_type (module, + IDE_TYPE_PREFERENCES_ADDIN, + GBP_TYPE_BUILDUI_PREFERENCES_ADDIN); peas_object_module_register_extension_type (module, IDE_TYPE_WORKSPACE_ADDIN, GBP_TYPE_BUILDUI_WORKSPACE_ADDIN); diff --git a/src/plugins/buildui/buildui.plugin b/src/plugins/buildui/buildui.plugin index dc55a10cfb27a75e6bad648c5a5c4ab30ef74bc2..5864fdb10604ec440bb233f82954e2968e459284 100644 --- a/src/plugins/buildui/buildui.plugin +++ b/src/plugins/buildui/buildui.plugin @@ -9,3 +9,4 @@ Hidden=true Module=buildui Name=Build user interface components X-Workspace-Kind=primary; +X-Preferences-Kind=project; \ No newline at end of file diff --git a/src/plugins/buildui/gbp-buildui-editor-page-addin.c b/src/plugins/buildui/gbp-buildui-editor-page-addin.c index 427f3e9a030626beb18d0006b113b20619ff7e5c..aabbdef3ab39c1eee6da56794f70f05c100baf3a 100644 --- a/src/plugins/buildui/gbp-buildui-editor-page-addin.c +++ b/src/plugins/buildui/gbp-buildui-editor-page-addin.c @@ -63,16 +63,17 @@ parse_version (const gchar *str, static void on_push_snippet_cb (GbpBuilduiEditorPageAddin *self, - IdeSnippet *snippet, - const GtkTextIter *iter, + GtkSourceSnippet *snippet, + GtkTextIter *iter, IdeSourceView *view) { g_autoptr(IdeContext) context = NULL; g_autofree gchar *project_version = NULL; + GtkSourceSnippetContext *snippet_context; GtkTextBuffer *buffer; g_assert (IDE_IS_MAIN_THREAD ()); - g_assert (IDE_IS_SNIPPET (snippet)); + g_assert (GTK_SOURCE_IS_SNIPPET (snippet)); g_assert (IDE_IS_SOURCE_VIEW (view)); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); @@ -105,9 +106,10 @@ on_push_snippet_cb (GbpBuilduiEditorPageAddin *self, } } - ide_snippet_context_add_variable (ide_snippet_get_context (snippet), - "project_version", - project_version ?: ""); + snippet_context = gtk_source_snippet_get_context (snippet); + gtk_source_snippet_context_set_variable (snippet_context, + "project_version", + project_version ?: ""); } static void diff --git a/src/plugins/buildui/gbp-buildui-preferences-addin.c b/src/plugins/buildui/gbp-buildui-preferences-addin.c new file mode 100644 index 0000000000000000000000000000000000000000..1a1c9bb49ac5bb82dc6306e074e5e1bf9ea79e01 --- /dev/null +++ b/src/plugins/buildui/gbp-buildui-preferences-addin.c @@ -0,0 +1,392 @@ +/* gbp-buildui-preferences-addin.h + * + * Copyright 2022 Georges Basile Stavracas Neto + * 2018-2019 Christian Hergert + * + * 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 3 of the License, 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, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#define G_LOG_DOMAIN "gbp-buildui-preferences-addin" + +#include "config.h" + +#include + +#include + +#include "gbp-buildui-preferences-addin.h" +#include "gbp-buildui-runtime-categories.h" +#include "gbp-buildui-runtime-row.h" + +struct _GbpBuilduiPreferencesAddin +{ + GObject parent_instance; +}; + +static gboolean +treat_null_as_empty (GBinding *binding, + const GValue *from_value, + GValue *to_value, + gpointer user_data) +{ + const char *str = g_value_get_string (from_value); + g_value_set_string (to_value, str ?: ""); + return TRUE; +} + +static void +add_description_row (AdwPreferencesGroup *group, + const char *title, + const char *value) +{ + GtkWidget *label; + GtkWidget *row; + + label = g_object_new (GTK_TYPE_LABEL, + "label", value, + "tooltip-text", value, + "selectable", TRUE, + "max-width-chars", 30, + NULL); + gtk_widget_add_css_class (label, "dim-label"); + + row = g_object_new (ADW_TYPE_ACTION_ROW, + "title", title, + NULL); + adw_action_row_add_suffix (ADW_ACTION_ROW (row), label); + adw_preferences_group_add (group, row); +} + +static void +add_entry_row (AdwPreferencesGroup *group, + const char *title, + gpointer source_object, + const char *bind_property) +{ + GtkWidget *row; + + row = g_object_new (ADW_TYPE_ENTRY_ROW, + "title", title, + NULL); + + g_object_bind_property_full (source_object, bind_property, + row, "text", + G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, + treat_null_as_empty, NULL, NULL, NULL); + + adw_preferences_group_add (group, row); +} + +static void +create_general_widgetry (const char *page_name, + const IdePreferenceItemEntry *entry, + AdwPreferencesGroup *group, + gpointer user_data) +{ + g_autoptr(GFile) workdir = NULL; + IdeConfig *config = user_data; + IdeConfigManager *config_manager; + IdeBuildSystem *build_system; + IdeContext *context; + GtkWidget *box; + static const struct { + const gchar *label; + const gchar *action; + const gchar *tooltip; + const gchar *style_class; + } actions[] = { + { + N_("Make _Active"), "config-manager.current", + N_("Select this configuration as the active configuration."), + }, + { + N_("_Duplicate"), "config-manager.duplicate", + N_("Duplicating the configuration allows making changes without modifying this configuration."), + }, + { + N_("_Remove"), "config-manager.delete", + N_("Removes the configuration and cannot be undone."), + "destructive-action", + }, + }; + + g_assert (IDE_IS_MAIN_THREAD ()); + g_assert (ADW_IS_PREFERENCES_GROUP (group)); + g_assert (IDE_IS_CONFIG (config)); + g_assert (page_name != NULL && g_str_equal (page_name, ide_config_get_id (config))); + + context = ide_object_get_context (IDE_OBJECT (config)); + build_system = ide_build_system_from_context (context); + workdir = ide_context_ref_workdir (context); + + add_description_row (group, _("Name"), ide_config_get_display_name (config)); + add_description_row (group, _("Source Directory"), g_file_peek_path (workdir)); + add_description_row (group, _("Build System"), ide_build_system_get_display_name (build_system)); + /* Translators: "Install" is a noun here */ + add_entry_row (group, _("Install Prefix"), config, "prefix"); + /* Translators: "Configure" is a noun here */ + add_entry_row (group, _("Configure Options"), config, "config-opts"); + /* Translators: "Run" is a noun here, this string is analogous to "Execution Options" */ + add_entry_row (group, _("Run Options"), config, "run-opts"); + + config_manager = ide_config_manager_from_context (context); + gtk_widget_insert_action_group (GTK_WIDGET (group), + "config-manager", + G_ACTION_GROUP (config_manager)); + + /* actions button box */ + box = g_object_new (GTK_TYPE_BOX, + "homogeneous", TRUE, + "margin-top", 12, + "spacing", 12, + "visible", TRUE, + NULL); + for (guint i = 0; i < G_N_ELEMENTS (actions); i++) + { + GtkWidget *button; + + button = g_object_new (GTK_TYPE_BUTTON, + "visible", TRUE, + "action-name", actions[i].action, + "action-target", g_variant_new_string (ide_config_get_id (config)), + "label", g_dgettext (GETTEXT_PACKAGE, actions[i].label), + "tooltip-text", g_dgettext (GETTEXT_PACKAGE, actions[i].tooltip), + "use-underline", TRUE, + NULL); + if (actions[i].style_class) + gtk_widget_add_css_class (button, actions[i].style_class); + gtk_box_append (GTK_BOX (box), button); + } + + adw_preferences_group_add (group, box); +} + +static void +notify_toolchain_id (IdeConfig *config, + GParamSpec *pspec, + GtkImage *image) +{ + const gchar *toolchain_id; + const gchar *current; + + g_assert (IDE_IS_MAIN_THREAD ()); + g_assert (IDE_IS_CONFIG (config)); + g_assert (GTK_IS_IMAGE (image)); + + toolchain_id = ide_config_get_toolchain_id (config); + current = g_object_get_data (G_OBJECT (image), "TOOLCHAIN_ID"); + + gtk_widget_set_visible (GTK_WIDGET (image), ide_str_equal0 (toolchain_id, current)); +} + +static GtkWidget * +create_toolchain_row (gpointer item, + gpointer user_data) +{ + IdeToolchain *toolchain = item; + IdeConfig *config = user_data; + const gchar *toolchain_id; + GtkWidget *image; + GtkWidget *row; + + g_assert (IDE_IS_MAIN_THREAD ()); + g_assert (IDE_IS_TOOLCHAIN (toolchain)); + g_assert (IDE_IS_CONFIG (config)); + + toolchain_id = ide_toolchain_get_id (toolchain); + + row = g_object_new (ADW_TYPE_ACTION_ROW, + "title", ide_toolchain_get_display_name (toolchain), + NULL); + + g_object_set_data_full (G_OBJECT (row), "TOOLCHAIN_ID", g_strdup (toolchain_id), g_free); + + image = g_object_new (GTK_TYPE_IMAGE, + "icon-name", "object-select-symbolic", + "valign", GTK_ALIGN_CENTER, + NULL); + g_object_set_data_full (G_OBJECT (image), "TOOLCHAIN_ID", g_strdup (toolchain_id), g_free); + adw_action_row_add_suffix (ADW_ACTION_ROW (row), image); + + g_signal_connect_object (config, + "notify::toolchain-id", + G_CALLBACK (notify_toolchain_id), + image, + 0); + + notify_toolchain_id (config, NULL, GTK_IMAGE (image)); + + return row; +} + +static void +on_toolchain_row_activated_cb (GtkListBox *list_box, + GtkListBoxRow *row, + IdeConfig *config) +{ + const gchar *toolchain_id; + + g_assert (IDE_IS_MAIN_THREAD ()); + g_assert (GTK_IS_LIST_BOX (list_box)); + g_assert (GTK_IS_LIST_BOX_ROW (row)); + g_assert (IDE_IS_CONFIG (config)); + + if ((toolchain_id = g_object_get_data (G_OBJECT (row), "TOOLCHAIN_ID"))) + ide_config_set_toolchain_id (config, toolchain_id); + + gtk_list_box_unselect_all (list_box); +} + +static void +create_toolchain_widgetry (const char *page_name, + const IdePreferenceItemEntry *entry, + AdwPreferencesGroup *group, + gpointer user_data) +{ + IdeToolchainManager *toolchain_manager; + IdeConfig *config = user_data; + GtkListBox *listbox; + IdeContext *context; + + g_assert (IDE_IS_MAIN_THREAD ()); + g_assert (ADW_IS_PREFERENCES_GROUP (group)); + g_assert (IDE_IS_CONFIG (config)); + g_assert (page_name != NULL && g_str_equal (page_name, ide_config_get_id (config))); + + context = ide_object_get_context (IDE_OBJECT (config)); + toolchain_manager = ide_toolchain_manager_from_context (context); + + listbox = GTK_LIST_BOX (gtk_list_box_new ()); + gtk_widget_add_css_class (GTK_WIDGET (listbox), "boxed-list"); + g_signal_connect_object (listbox, + "row-activated", + G_CALLBACK (on_toolchain_row_activated_cb), + config, + 0); + + gtk_list_box_bind_model (listbox, + G_LIST_MODEL (toolchain_manager), + create_toolchain_row, + g_object_ref (config), + g_object_unref); + + adw_preferences_group_add (group, GTK_WIDGET (listbox)); +} + +static void +create_runtime_widgetry (const char *page_name, + const IdePreferenceItemEntry *entry, + AdwPreferencesGroup *group, + gpointer user_data) +{ + g_autoptr(GbpBuilduiRuntimeCategories) filter = NULL; + IdeRuntimeManager *runtime_manager; + IdeContext *context; + IdeConfig *config = user_data; + + g_assert (IDE_IS_MAIN_THREAD ()); + g_assert (ADW_IS_PREFERENCES_GROUP (group)); + g_assert (IDE_IS_CONFIG (config)); + g_assert (page_name != NULL && g_str_equal (page_name, ide_config_get_id (config))); + + context = ide_object_get_context (IDE_OBJECT (config)); + runtime_manager = ide_runtime_manager_from_context (context); + + filter = gbp_buildui_runtime_categories_new (runtime_manager, NULL); + + // TODO +} + +static void +gbp_buildui_preferences_addin_load (IdePreferencesAddin *addin, + IdePreferencesWindow *window, + IdeContext *context) +{ + GbpBuilduiPreferencesAddin *self = (GbpBuilduiPreferencesAddin *)addin; + IdePreferencePageEntry *pages; + IdeConfigManager *config_manager; + guint n_configs; + + IDE_ENTRY; + + g_assert (IDE_IS_MAIN_THREAD ()); + g_assert (GBP_IS_BUILDUI_PREFERENCES_ADDIN (self)); + g_assert (IDE_IS_PREFERENCES_WINDOW (window)); + g_assert (!context || IDE_IS_CONTEXT (context)); + g_assert (ide_preferences_window_get_mode (window) == IDE_PREFERENCES_MODE_PROJECT); + + config_manager = ide_config_manager_from_context (context); + n_configs = g_list_model_get_n_items (G_LIST_MODEL (config_manager)); + pages = g_new0 (IdePreferencePageEntry, n_configs); + for (guint i = 0; i < n_configs; i++) + { + IdePreferencePageEntry *page; + g_autoptr(IdeConfig) config = NULL; + + page = &pages[i]; + config = g_list_model_get_item (G_LIST_MODEL (config_manager), i); + + page->parent = "build"; + page->section = NULL; + page->name = ide_config_get_id (config); + page->icon_name = NULL; + page->title = ide_config_get_display_name (config); + } + + ide_preferences_window_add_pages (window, pages, n_configs, NULL); + + for (guint i = 0; i < n_configs; i++) + { + g_autoptr(IdeConfig) config = g_list_model_get_item (G_LIST_MODEL (config_manager), i); + const char *page = ide_config_get_id (config); + + const IdePreferenceGroupEntry groups[] = { + { page, "general", 0, N_("General") }, + { page, "toolchain", 100, N_("Build Toolchain") }, + { page, "runtime", 200, N_("Application Runtime") }, + }; + + const IdePreferenceItemEntry items[] = { + { page, "general", "general", 0, create_general_widgetry }, + { page, "toolchain", "toolchain", 100, create_toolchain_widgetry }, + { page, "runtime", "runtime", 200, create_runtime_widgetry }, + }; + + ide_preferences_window_add_groups (window, groups, G_N_ELEMENTS (groups), NULL); + ide_preferences_window_add_items (window, items, G_N_ELEMENTS (items), config, NULL); + } + + IDE_EXIT; +} + +static void +preferences_addin_init (IdePreferencesAddinInterface *iface) +{ + iface->load = gbp_buildui_preferences_addin_load; +} + +G_DEFINE_TYPE_WITH_CODE (GbpBuilduiPreferencesAddin, gbp_buildui_preferences_addin, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (IDE_TYPE_PREFERENCES_ADDIN, preferences_addin_init)) + +static void +gbp_buildui_preferences_addin_class_init (GbpBuilduiPreferencesAddinClass *klass) +{ +} + +static void +gbp_buildui_preferences_addin_init (GbpBuilduiPreferencesAddin *self) +{ +} diff --git a/src/plugins/buildui/gbp-buildui-preferences-addin.h b/src/plugins/buildui/gbp-buildui-preferences-addin.h new file mode 100644 index 0000000000000000000000000000000000000000..40126c91b4197c174a8a67e5c13501cbee58d046 --- /dev/null +++ b/src/plugins/buildui/gbp-buildui-preferences-addin.h @@ -0,0 +1,31 @@ +/* gbp-buildui-preferences-addin.h + * + * Copyright 2022 Georges Basile Stavracas Neto + * 2018-2019 Christian Hergert + * + * 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 3 of the License, 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, see . + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#pragma once + +#include + +G_BEGIN_DECLS + +#define GBP_TYPE_BUILDUI_PREFERENCES_ADDIN (gbp_buildui_preferences_addin_get_type()) +G_DECLARE_FINAL_TYPE (GbpBuilduiPreferencesAddin, gbp_buildui_preferences_addin, GBP, BUILDUI_PREFERENCES_ADDIN, GObject) + +G_END_DECLS diff --git a/src/plugins/buildui/gbp-buildui-runtime-categories.c b/src/plugins/buildui/gbp-buildui-runtime-categories.c index 4bea7cd0a54253c10fcf6db0f890862b18227c98..5f2b9fe58e8ff5b477908625c3da9243e775b5b6 100644 --- a/src/plugins/buildui/gbp-buildui-runtime-categories.c +++ b/src/plugins/buildui/gbp-buildui-runtime-categories.c @@ -35,16 +35,6 @@ struct _GbpBuilduiRuntimeCategories IdeRuntimeManager *runtime_manager; }; -static gboolean -filter_by_category (GObject *object, - gpointer user_data) -{ - const gchar *category = user_data; - IdeRuntime *runtime = IDE_RUNTIME (object); - - return ide_str_equal0 (category, ide_runtime_get_category (runtime)); -} - static GType gbp_buildui_runtime_categories_get_item_type (GListModel *model) { @@ -224,7 +214,8 @@ gbp_buildui_runtime_categories_create_child_model (GbpBuilduiRuntimeCategories * { g_autofree gchar *prefix = NULL; g_autofree gchar *name = NULL; - DzlListModelFilter *filter; + GtkFilterListModel *filter_model; + GtkStringFilter *filter; g_assert (IDE_IS_MAIN_THREAD ()); g_assert (GBP_IS_BUILDUI_RUNTIME_CATEGORIES (self)); @@ -240,12 +231,9 @@ gbp_buildui_runtime_categories_create_child_model (GbpBuilduiRuntimeCategories * if (g_str_has_suffix (category, "/")) return G_LIST_MODEL (gbp_buildui_runtime_categories_new (self->runtime_manager, prefix)); - filter = dzl_list_model_filter_new (G_LIST_MODEL (self->runtime_manager)); + filter = gtk_string_filter_new (gtk_property_expression_new (IDE_TYPE_RUNTIME, NULL, "caregory")); + filter_model = gtk_filter_list_model_new (G_LIST_MODEL (self->runtime_manager), GTK_FILTER (filter)); g_object_set_data_full (G_OBJECT (filter), "CATEGORY", g_steal_pointer (&name), g_free); - dzl_list_model_filter_set_filter_func (filter, - filter_by_category, - g_strdup (prefix), - g_free); - return G_LIST_MODEL (g_steal_pointer (&filter)); + return G_LIST_MODEL (g_steal_pointer (&filter_model)); } diff --git a/src/plugins/buildui/gbp-buildui-runtime-row.c b/src/plugins/buildui/gbp-buildui-runtime-row.c index 2a3774c3503c9fa500db1deb4946afc3ae98ed0f..2599ff0b2cc53a93f29dd8f862273f6ffe394d69 100644 --- a/src/plugins/buildui/gbp-buildui-runtime-row.c +++ b/src/plugins/buildui/gbp-buildui-runtime-row.c @@ -26,15 +26,14 @@ struct _GbpBuilduiRuntimeRow { - GtkListBoxRow parent_instance; + AdwActionRow parent_instance; gchar *runtime_id; - GtkLabel *label; GtkImage *image; }; -G_DEFINE_FINAL_TYPE (GbpBuilduiRuntimeRow, gbp_buildui_runtime_row, GTK_TYPE_LIST_BOX_ROW) +G_DEFINE_FINAL_TYPE (GbpBuilduiRuntimeRow, gbp_buildui_runtime_row, ADW_TYPE_ACTION_ROW) static void gbp_buildui_runtime_row_finalize (GObject *object) @@ -57,30 +56,11 @@ gbp_buildui_runtime_row_class_init (GbpBuilduiRuntimeRowClass *klass) static void gbp_buildui_runtime_row_init (GbpBuilduiRuntimeRow *self) { - GtkWidget *box; - - box = g_object_new (GTK_TYPE_BOX, - "margin", 10, - "orientation", GTK_ORIENTATION_HORIZONTAL, - "spacing", 6, - "visible", TRUE, - NULL); - gtk_container_add (GTK_CONTAINER (self), box); - - self->label = g_object_new (GTK_TYPE_LABEL, - "visible", TRUE, - "use-markup", TRUE, - "xalign", 0.0f, - NULL); - gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (self->label)); - self->image = g_object_new (GTK_TYPE_IMAGE, - "visible", TRUE, - "halign", GTK_ALIGN_START, - "hexpand", TRUE, + "valign", GTK_ALIGN_CENTER, "icon-name", "object-select-symbolic", NULL); - gtk_container_add (GTK_CONTAINER (box), GTK_WIDGET (self->image)); + adw_action_row_add_suffix (ADW_ACTION_ROW (self), GTK_WIDGET (self->image)); } static void @@ -97,8 +77,8 @@ notify_config_runtime_id (GbpBuilduiRuntimeRow *self, } GtkWidget * -gbp_buildui_runtime_row_new (IdeRuntime *runtime, - IdeConfig *config) +gbp_buildui_runtime_row_new (IdeRuntime *runtime, + IdeConfig *config) { GbpBuilduiRuntimeRow *self; gboolean sensitive; @@ -110,11 +90,10 @@ gbp_buildui_runtime_row_new (IdeRuntime *runtime, self = g_object_new (GBP_TYPE_BUILDUI_RUNTIME_ROW, "sensitive", sensitive, - "visible", TRUE, NULL); self->runtime_id = g_strdup (ide_runtime_get_id (runtime)); - gtk_label_set_label (self->label, - ide_runtime_get_display_name (runtime)); + adw_preferences_row_set_title (ADW_PREFERENCES_ROW (self), + ide_runtime_get_display_name (runtime)); g_signal_connect_object (config, "notify::runtime-id", diff --git a/src/plugins/buildui/gbp-buildui-runtime-row.h b/src/plugins/buildui/gbp-buildui-runtime-row.h index c7dfff99f85106d8e044f7939648c24e2679b5c7..c646d3a3446efd84e605a1a47afe75ae4d81eed2 100644 --- a/src/plugins/buildui/gbp-buildui-runtime-row.h +++ b/src/plugins/buildui/gbp-buildui-runtime-row.h @@ -20,14 +20,14 @@ #pragma once -#include +#include #include G_BEGIN_DECLS #define GBP_TYPE_BUILDUI_RUNTIME_ROW (gbp_buildui_runtime_row_get_type()) -G_DECLARE_FINAL_TYPE (GbpBuilduiRuntimeRow, gbp_buildui_runtime_row, GBP, BUILDUI_RUNTIME_ROW, GtkListBoxRow) +G_DECLARE_FINAL_TYPE (GbpBuilduiRuntimeRow, gbp_buildui_runtime_row, GBP, BUILDUI_RUNTIME_ROW, AdwActionRow) GtkWidget *gbp_buildui_runtime_row_new (IdeRuntime *runtime, IdeConfig *config); diff --git a/src/plugins/buildui/gbp-buildui-targets-dialog.c b/src/plugins/buildui/gbp-buildui-targets-dialog.c index e8735f25069add8b7ba4acc33c240e15fad30355..8568c84da3c897a88f8365c7ef922c293c66540e 100644 --- a/src/plugins/buildui/gbp-buildui-targets-dialog.c +++ b/src/plugins/buildui/gbp-buildui-targets-dialog.c @@ -125,6 +125,8 @@ gbp_buildui_targets_dialog_list_targets_cb (GObject *object, g_autoptr(GListModel) model = NULL; g_autoptr(GError) error = NULL; + IDE_ENTRY; + g_assert (IDE_IS_BUILD_MANAGER (build_manager)); g_assert (G_IS_ASYNC_RESULT (result)); g_assert (GBP_IS_BUILDUI_TARGETS_DIALOG (self)); diff --git a/src/plugins/buildui/meson.build b/src/plugins/buildui/meson.build index 059368039d243b502ddbcdce0a133709227891cc..b741aedf5e8e3c3eb54d5eb1f1243bc385c1e822 100644 --- a/src/plugins/buildui/meson.build +++ b/src/plugins/buildui/meson.build @@ -2,12 +2,13 @@ plugins_sources += files([ 'buildui-plugin.c', #'gbp-buildui-config-surface.c', #'gbp-buildui-config-view-addin.c', - #'gbp-buildui-editor-page-addin.c', + 'gbp-buildui-editor-page-addin.c', 'gbp-buildui-log-pane.c', 'gbp-buildui-omni-bar-section.c', 'gbp-buildui-pane.c', - #'gbp-buildui-runtime-categories.c', - #'gbp-buildui-runtime-row.c', + 'gbp-buildui-preferences-addin.c', + 'gbp-buildui-runtime-categories.c', + 'gbp-buildui-runtime-row.c', 'gbp-buildui-stage-row.c', 'gbp-buildui-targets-dialog.c', 'gbp-buildui-tree-addin.c',