Initial work on some gtk4 widgets
--- a/.hgignore Fri Jul 30 02:09:45 2021 -0500
+++ b/.hgignore Mon Aug 02 23:43:22 2021 -0500
@@ -17,3 +17,7 @@
+^subprojects\/libsass\.wrap +^subprojects\/sassc\.wrap --- a/gplugin-gtk-viewer/gplugin-gtk-viewer.c Fri Jul 30 02:09:45 2021 -0500
+++ b/gplugin-gtk-viewer/gplugin-gtk-viewer.c Mon Aug 02 23:43:22 2021 -0500
@@ -15,8 +15,8 @@
* License along with this library; if not, see <https://www.gnu.org/licenses/>.
+#include <glib/gstdio.h> @@ -44,26 +44,6 @@
-selection_changed_cb(GtkTreeSelection *sel, gpointer data)
- GPluginGtkPluginInfo *info = GPLUGIN_GTK_PLUGIN_INFO(data);
- GPluginPlugin *plugin = NULL;
- GtkTreeModel *model = NULL;
- if(gtk_tree_selection_get_selected(sel, &model, &iter)) {
- GPLUGIN_GTK_STORE_PLUGIN_COLUMN,
- gplugin_gtk_plugin_info_set_plugin(info, plugin);
/******************************************************************************
*****************************************************************************/
@@ -100,57 +80,11 @@
- printf("gplugin-gtk-viewer %s\n", GPLUGIN_VERSION);
+ printf("gplugin-gtk4-viewer %s\n", GPLUGIN_VERSION);
- GtkWidget *window = NULL, *grid = NULL, *sw = NULL;
- GtkWidget *view = NULL, *info = NULL;
- GtkTreeSelection *sel = NULL;
- window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_title(GTK_WINDOW(window), "GPlugin Viewer");
- gtk_container_set_border_width(GTK_CONTAINER(window), 12);
- G_CALLBACK(window_closed_cb),
- gtk_grid_set_row_homogeneous(GTK_GRID(grid), TRUE);
- gtk_grid_set_column_spacing(GTK_GRID(grid), 12);
- gtk_container_add(GTK_CONTAINER(window), grid);
- sw = gtk_scrolled_window_new(NULL, NULL);
- gtk_scrolled_window_set_policy(
- GTK_SCROLLED_WINDOW(sw),
- gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
- gtk_grid_attach(GTK_GRID(grid), sw, 0, 0, 1, 1);
- view = gplugin_gtk_view_new();
- gplugin_gtk_view_set_show_internal(GPLUGIN_GTK_VIEW(view), show_internal);
- gtk_container_add(GTK_CONTAINER(sw), view);
- info = gplugin_gtk_plugin_info_new();
- gtk_grid_attach(GTK_GRID(grid), info, 1, 0, 1, 1);
- sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(view));
- G_CALLBACK(selection_changed_cb),
/******************************************************************************
*****************************************************************************/
@@ -192,7 +126,7 @@
g_option_context_free(ctx);
- fprintf(stderr, "%s\n", error->message);
+ g_fprintf(stderr, "%s\n", error->message); @@ -222,8 +156,8 @@
gplugin_manager_refresh();
/* now create and show the window */
- window = create_window();
- gtk_widget_show_all(window);
+ // window = create_window(); + // gtk_widget_show_all(window); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4-viewer/gplugin-gtk-viewer-window.c Mon Aug 02 23:43:22 2021 -0500
@@ -0,0 +1,60 @@
+ * Copyright (C) 2011-2021 Gary Kramlich <grim@reaperworld.com> + * 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 of the License, or (at your option) any later version. + * 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, see + * <https://www.gnu.org/licenses/>. +#include "gplugin-gtk-viewer-window.h" +struct _GPluginGtkViewerWindow { + GtkApplicationWindow parent; + GPluginGtkViewerWindow, + gplugin_gtk_viewer_window, + GTK_TYPE_APPLICATION_WINDOW) +/****************************************************************************** + *****************************************************************************/ +gplugin_gtk_viewer_window_init(GPluginGtkViewerWindow *window) + gtk_widget_init_template(GTK_WIDGET(window)); +gplugin_gtk_viewer_window_class_init(GPluginGtkViewerWindowClass *klass) + gtk_widget_class_set_template_from_resource( + GTK_WIDGET_CLASS(klass), + "/org/imfreedom/keep/gplugin/gplugin/viewer/window.ui"); +/****************************************************************************** + *****************************************************************************/ +gplugin_gtk_viewer_window_new(GApplication *application) + return GTK_WIDGET(g_object_new( + GPLUGIN_GTK_VIEWER_TYPE_WINDOW, + "application", application, --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4-viewer/gplugin-gtk-viewer-window.h Mon Aug 02 23:43:22 2021 -0500
@@ -0,0 +1,40 @@
+ * Copyright (C) 2011-2021 Gary Kramlich <grim@reaperworld.com> + * 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 of the License, or (at your option) any later version. + * 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, see <https://www.gnu.org/licenses/>. +#ifndef GPLUGIN_GTK_VIEWER_WINDOW_H +#define GPLUGIN_GTK_VIEWER_WINDOW_H +#include <glib-object.h> +#define GPLUGIN_GTK_VIEWER_TYPE_WINDOW (gplugin_gtk_viewer_window_get_type()) + GPluginGtkViewerWindow, + gplugin_gtk_viewer_window, +GtkWidget *gplugin_gtk_viewer_window_new(GApplication *application); +#endif /* GPLUGIN_GTK_VIEWER_WINDOW_H */ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4-viewer/gplugin-gtk-viewer.c Mon Aug 02 23:43:22 2021 -0500
@@ -0,0 +1,134 @@
+ * Copyright (C) 2011-2021 Gary Kramlich <grim@reaperworld.com> + * 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 of the License, or (at your option) any later version. + * 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, see <https://www.gnu.org/licenses/>. +#include <gplugin-gtk4.h> +#include "gplugin-gtk-viewer-window.h" +/****************************************************************************** + *****************************************************************************/ +static gboolean show_internal = FALSE, version_only = FALSE; +/****************************************************************************** + *****************************************************************************/ + G_GNUC_UNUSED const gchar *n, + G_GNUC_UNUSED const gchar *v, + G_GNUC_UNUSED gpointer d, + G_GNUC_UNUSED GError **e) + G_GNUC_UNUSED const gchar *n, + G_GNUC_UNUSED const gchar *v, + G_GNUC_UNUSED gpointer d, + G_GNUC_UNUSED GError **e) + printf("gplugin-gtk4-viewer %s\n", GPLUGIN_VERSION); +/****************************************************************************** + *****************************************************************************/ +gplugin_gtk_viewer_startup(GApplication *application, gpointer data) + gplugin_init(GPLUGIN_CORE_FLAGS_NONE); +gplugin_gtk_viewer_shutdown(GApplication *application, gpointer data) +gplugin_gtk_viewer_activate(GApplication *application, gpointer data) + GtkWidget *window = NULL; + window = gplugin_gtk_viewer_window_new(application); + gtk_widget_show(window); +static GOptionEntry entries[] = { + "internal", 'i', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, + internal_cb, "Show internal plugins", + "version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, + version_cb, "Display the version and exit", + NULL, 0, 0, 0, NULL, NULL, NULL, +main(gint argc, gchar **argv) + GApplication *application = NULL; + application = G_APPLICATION(gtk_application_new( + "org.imfreedom.keep.gplugin.gplugin.gplugin-gtk4-viewer", + G_APPLICATION_NON_UNIQUE)); + g_application_add_main_option_entries(application, entries); + g_application_add_option_group(application, gplugin_get_option_group()); + G_CALLBACK(gplugin_gtk_viewer_startup), + G_CALLBACK(gplugin_gtk_viewer_shutdown), + G_CALLBACK(gplugin_gtk_viewer_activate), + return g_application_run(application, argc, argv); --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4-viewer/meson.build Mon Aug 02 23:43:22 2021 -0500
@@ -0,0 +1,25 @@
+if not get_option('install-gplugin-gtk4-viewer') +summary('gplugin-gtk4-viewer', + 'You have disabled installation of gplugin-gtk4-viewer which is a ' + + 'very useful diagnostics tool.', +gplugin_gtk4_viewer_resources = gnome.compile_resources( + 'gplugin-gtk4-viewer-resources', + 'resources/gplugin-gtk-viewer.gresource.xml', + c_name: 'gplugin_gtk_viewer', + source_dir: 'resources') +gplugin_gtk_viewer = executable('gplugin-gtk4-viewer', + 'gplugin-gtk-viewer.c', + 'gplugin-gtk-viewer-window.c', + 'gplugin-gtk-viewer-window.h', + gplugin_gtk4_viewer_resources, + dependencies : [gplugin_dep, gplugin_gtk4_dep], + install : get_option('install-gplugin-gtk4-viewer') \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4-viewer/resources/gplugin-gtk-viewer.gresource.xml Mon Aug 02 23:43:22 2021 -0500
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?> + <gresource prefix="/org/imfreedom/keep/gplugin/gplugin/viewer/"> + <file compressed="true">window.ui</file> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4-viewer/resources/row.ui Mon Aug 02 23:43:22 2021 -0500
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?> + <template class="GPluginGtkViewerRow" parent="AdwActionRow"> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4-viewer/resources/window.ui Mon Aug 02 23:43:22 2021 -0500
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> + <template class="GPluginGtkViewerWindow" parent="GtkApplicationWindow"> + <property name="title" translatable="yes">GPlugin Viewer</property> + <object class="GtkScrolledWindow"> + <property name="hscrollbar-policy">never</property> + <property name="min-content-height">200</property> + <property name="hexpand">0</property> + <property name="vexpand">1</property> + <object class="GPluginGtkList" id="list"/> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/gplugin-gtk-list.c Mon Aug 02 23:43:22 2021 -0500
@@ -0,0 +1,59 @@
+ * Copyright (C) 2011-2021 Gary Kramlich <grim@reaperworld.com> + * 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 of the License, or (at your option) any later version. + * 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, see + * <https://www.gnu.org/licenses/>. +#include "gplugin-gtk-list.h" +struct _GPluginGtkList { +/****************************************************************************** + *****************************************************************************/ +gplugin_gtk_list_init(GPluginGtkList *list) + gtk_widget_init_template(GTK_WIDGET(list)); +gplugin_gtk_list_class_init(GPluginGtkListClass *klass) + gtk_widget_class_set_template_from_resource( + GTK_WIDGET_CLASS(klass), + "/org/imfreedom/keep/gplugin/gplugin/list.ui"); +/****************************************************************************** + *****************************************************************************/ +gplugin_gtk_list_new(void) + return GTK_WIDGET(g_object_new( --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/gplugin-gtk-list.h Mon Aug 02 23:43:22 2021 -0500
@@ -0,0 +1,40 @@
+ * Copyright (C) 2011-2021 Gary Kramlich <grim@reaperworld.com> + * 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 of the License, or (at your option) any later version. + * 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, see <https://www.gnu.org/licenses/>. +#ifndef GPLUGIN_GTK_LIST_H +#define GPLUGIN_GTK_LIST_H +#include <glib-object.h> +#define GPLUGIN_GTK_TYPE_LIST (gplugin_gtk_list_get_type()) +GtkWidget *gplugin_gtk_list_new(void); +#endif /* GPLUGIN_GTK_LIST_H */ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/gplugin-gtk-row.c Mon Aug 02 23:43:22 2021 -0500
@@ -0,0 +1,59 @@
+ * Copyright (C) 2011-2021 Gary Kramlich <grim@reaperworld.com> + * 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 of the License, or (at your option) any later version. + * 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, see + * <https://www.gnu.org/licenses/>. +#include "gplugin-gtk-row.h" +/****************************************************************************** + *****************************************************************************/ +gplugin_gtk_row_init(GPluginGtkRow *row) + gtk_widget_init_template(GTK_WIDGET(row)); +gplugin_gtk_row_class_init(GPluginGtkRowClass *klass) + gtk_widget_class_set_template_from_resource( + GTK_WIDGET_CLASS(klass), + "/org/imfreedom/keep/gplugin/gplugin/row.ui"); +/****************************************************************************** + *****************************************************************************/ +gplugin_gtk_row_new(void) + return GTK_WIDGET(g_object_new( --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/gplugin-gtk-row.h Mon Aug 02 23:43:22 2021 -0500
@@ -0,0 +1,42 @@
+ * Copyright (C) 2011-2021 Gary Kramlich <grim@reaperworld.com> + * 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 of the License, or (at your option) any later version. + * 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, see <https://www.gnu.org/licenses/>. +#ifndef GPLUGIN_GTK_ROW_H +#define GPLUGIN_GTK_ROW_H +#include <glib-object.h> +#define GPLUGIN_GTK_TYPE_ROW (gplugin_gtk_row_get_type()) +GtkWidget *gplugin_gtk_row_new(void); +#endif /* GPLUGIN_GTK_ROW_H */ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/gplugin-gtk4.h.in Mon Aug 02 23:43:22 2021 -0500
@@ -0,0 +1,34 @@
+ * Copyright (C) 2011-2021 Gary Kramlich <grim@reaperworld.com> + * 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 of the License, or (at your option) any later version. + * 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, see <https://www.gnu.org/licenses/>. +# ifdef GPLUGIN_GTK4_COMPILATION +# error "gplugin-gtk4 source files should not include gplugin-gtk4.h" +# endif /* GPLUGIN_GTK4_COMPILATION */ +#endif /* __GI_SCANNER__ */ +#ifndef GPLUGIN_GTK4_GLOBAL_HEADER_INSIDE +# define GPLUGIN_GTK4_GLOBAL_HEADER_INSIDE +#endif /* GPLUGIN_GTK4_GLOBAL_HEADER_INSIDE */ +@GPLUGIN_GTK4_H_INCLUDES@ +#undef GPLUGIN_GTK4_GLOBAL_HEADER_INSIDE +#endif /* GPLUGIN_GTK4_H */ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/meson.build Mon Aug 02 23:43:22 2021 -0500
@@ -0,0 +1,71 @@
+GTK4 = dependency('gtk4', version : '>=4.0.0') +LIBADWAITA = dependency('libadwaita-1') +GPLUGIN_GTK4_SOURCES = [ +GPLUGIN_GTK4_HEADERS = [ +GPLUGIN_GTK4_H_INCLUDES = '' +foreach header : GPLUGIN_GTK_HEADERS + GPLUGIN_GTK4_H_INCLUDES = '@0@\n#include <gplugin-gtk4/@1@>'.format( + GPLUGIN_GTK4_H_INCLUDES, +conf = configuration_data() +conf.set('GPLUGIN_GTK_H_INCLUDES', GPLUGIN_GTK_H_INCLUDES) +gplugin_gtk_h = configure_file( + input : 'gplugin-gtk4.h.in', + output : 'gplugin-gtk4.h', + install_dir : get_option('includedir') / 'gplugin-1.0') +gplugin_gtk4_resources = gnome.compile_resources( + 'gplugin-gtk4-resources', + 'resources/gplugin-gtk.gresource.xml', + source_dir: 'resources') +gplugin_gtk4 = library('gplugin-gtk4', + gplugin_gtk4_resources, + c_args : ['-DPLUGIN_GTK4_COMPILATION', '-DG_LOG_DOMAIN="GPluginGtk4"'], + include_directories : toplevel_inc, + dependencies : [gplugin_dep, GTK4, LIBADWAITA], + version : '@0@.@1@.@2@'.format(GPLUGIN_MAJOR_VERSION, GPLUGIN_MINOR_VERSION, GPLUGIN_MICRO_VERSION), +gplugin_gtk4_inc = include_directories('.') +gplugin_gtk4_dep = declare_dependency( + include_directories : [toplevel_inc, gplugin_gtk4_inc], + link_with : [gplugin, gplugin_gtk4], + dependencies : [GLIB, GOBJECT, GTK4, LIBADWAITA], + name : 'libgplugin-gtk4', + description : 'Gtk4 widgets for GPlugin', + filebase : 'gplugin-gtk4', + subdirs : 'gplugin-1.0', + requires : [GLIB, GOBJECT, GTK4], + subdir : 'gplugin-1.0/gplugin-gtk4', --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/resources/gplugin-gtk.gresource.xml Mon Aug 02 23:43:22 2021 -0500
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?> + <gresource prefix="/org/imfreedom/keep/gplugin/gplugin/viewer/"> + <file compressed="true">row.ui</file> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/resources/list.ui Mon Aug 02 23:43:22 2021 -0500
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?> + <template class="GPluginGtkList" parent="GtkListBox"> + <property name="activate-on-single-click">false</property> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin-gtk4/resources/row.ui Mon Aug 02 23:43:22 2021 -0500
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?> + <template class="GPluginGtkViewerRow" parent="AdwActionRow"> --- a/meson.build Fri Jul 30 02:09:45 2021 -0500
+++ b/meson.build Mon Aug 02 23:43:22 2021 -0500
@@ -16,6 +16,8 @@
parts = parts[0].split('.')
GPLUGIN_MAJOR_VERSION = parts[0]
+GPLUGIN_MINOR_VERSION = parts[1] +GPLUGIN_MICRO_VERSION = parts[2] version_conf = configuration_data()
version_conf.set('GPLUGIN_MAJOR_VERSION', GPLUGIN_MAJOR_VERSION)
@@ -86,6 +88,8 @@
subdir('gplugin-gtk-viewer')
+subdir('gplugin-gtk4-viewer') @@ -116,6 +120,7 @@
'gtk-doc' : get_option('doc'),
'gtk3 widgets' : get_option('gtk3'),
+ 'gtk4 widgets' : get_option('gtk4'), 'man pages' : get_option('help2man'),
}, bool_yn : true, section : 'Miscellaneous')
--- a/meson_options.txt Fri Jul 30 02:09:45 2021 -0500
+++ b/meson_options.txt Mon Aug 02 23:43:22 2021 -0500
@@ -17,6 +17,12 @@
+ type : 'boolean', value : true, + description : 'Whether or not to build the gtk4library' type : 'boolean', value : true,
description : 'Whether or not to build man pages from --help output'
@@ -29,6 +35,12 @@
+ 'install-gplugin-gtk4-viewer', + type : 'boolean', value : true, + description : 'Whether or not to install the gtk4 viewer application' type : 'boolean', value : true,
description : 'Whether or not to install the query application'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/subprojects/libadwaita-1.wrap Mon Aug 02 23:43:22 2021 -0500
@@ -0,0 +1,7 @@
+url = https://gitlab.gnome.org/GNOME/libadwaita.git +dependency_names = libadwaita-1 +libadwaita-1 = libadwaita_dep