[gtranslator: 3/10] Port ProgressBar to GtkBin
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator: 3/10] Port ProgressBar to GtkBin
- Date: Mon, 21 Mar 2022 07:03:15 +0000 (UTC)
commit 2ef39017e2c8d6999e81aa83b9d36e3875203c06
Author: Maximiliano Sandoval R <msandova gnome org>
Date: Tue Mar 15 21:17:12 2022 +0100
Port ProgressBar to GtkBin
So we can remove the libdazzle dependency, which is incompatible with
GTK 4.
- gtr_search_bar_set_search was not used in the code
- search_entry_populate_popup was removed, so the popup on the right
click was lost. But the options remain there in the button on the right.
Losing the popup is reasonable since that API is absent from
GtkSearchBar in GTK 4 anyways.
build-aux/flatpak/org.gnome.Gtranslator.json | 18 ----
meson.build | 3 +-
src/gtr-search-bar.c | 139 ++++++---------------------
src/gtr-search-bar.h | 3 +-
src/gtr-search-bar.ui | 6 +-
src/styles.css | 2 +-
6 files changed, 33 insertions(+), 138 deletions(-)
---
diff --git a/build-aux/flatpak/org.gnome.Gtranslator.json b/build-aux/flatpak/org.gnome.Gtranslator.json
index 01a9bafb..193a660d 100644
--- a/build-aux/flatpak/org.gnome.Gtranslator.json
+++ b/build-aux/flatpak/org.gnome.Gtranslator.json
@@ -32,24 +32,6 @@
"*.a"
],
"modules" : [
- {
- "name" : "libdazzle",
- "config-opts" : [
- "--libdir=/app/lib",
- "--buildtype=debugoptimized"
- ],
- "buildsystem" : "meson",
- "builddir" : true,
- "cleanup" : [
- "/bin"
- ],
- "sources" : [
- {
- "type" : "git",
- "url" : "https://gitlab.gnome.org/GNOME/libdazzle.git"
- }
- ]
- },
{
"name" : "gspell",
"config-opts" : [
diff --git a/meson.build b/meson.build
index 1a2a0ac7..a308f7b1 100644
--- a/meson.build
+++ b/meson.build
@@ -103,7 +103,7 @@ src_dir = join_paths(meson.source_root(), 'src')
# Dependencies #
################
-glib_dep = dependency('glib-2.0', version: '>= 2.36.0')
+glib_dep = dependency('glib-2.0', version: '>= 2.71.3')
gtk_dep = dependency('gtk+-3.0', version: '>= 3.22.20')
libhandy_dep = dependency('libhandy-1', version: '>= 1.5.0')
@@ -111,7 +111,6 @@ gtr_deps = [
glib_dep,
gtk_dep,
libhandy_dep,
- dependency('libdazzle-1.0', version: '>= 3.33.90'),
dependency('libgda-6.0'),
dependency('gio-2.0', version: '>= 2.36.0'),
dependency('gsettings-desktop-schemas'),
diff --git a/src/gtr-search-bar.c b/src/gtr-search-bar.c
index 42494b81..2dfbcfe0 100644
--- a/src/gtr-search-bar.c
+++ b/src/gtr-search-bar.c
@@ -20,7 +20,6 @@
#include "config.h"
-#include <dazzle.h>
#include <glib/gi18n.h>
#include "gtr-search-bar.h"
@@ -31,10 +30,9 @@
struct _GtrSearchBar
{
- DzlBin parent_instance;
+ GtkBin parent_instance;
- DzlSignalGroup *search_signals;
- DzlBindingGroup *search_bindings;
+ GBindingGroup *search_bindings;
GtkSearchEntry *search;
GObject *search_entry_tag;
@@ -55,8 +53,6 @@ struct _GtrSearchBar
GtrWindow *active_window;
- guint match_source;
-
guint show_options : 1;
guint replace_mode : 1;
};
@@ -73,7 +69,7 @@ enum {
N_SIGNALS
};
-G_DEFINE_FINAL_TYPE (GtrSearchBar, gtr_search_bar, DZL_TYPE_BIN)
+G_DEFINE_FINAL_TYPE (GtrSearchBar, gtr_search_bar, GTK_TYPE_BIN)
static GParamSpec *properties [N_PROPS];
static guint signals [N_SIGNALS];
@@ -439,62 +435,6 @@ gtr_search_bar_grab_focus (GtkWidget *widget)
gtk_widget_grab_focus (GTK_WIDGET (self->search_entry));
}
-static void
-search_entry_populate_popup (GtrSearchBar *self,
- GtkWidget *widget,
- GtkEntry *entry)
-{
- g_assert (GTR_IS_SEARCH_BAR (self));
- g_assert (GTK_IS_MENU (widget));
- g_assert (GTK_IS_ENTRY (entry));
-
- if (GTK_IS_MENU (widget))
- {
- g_autoptr(DzlPropertiesGroup) group = NULL;
-
- GtkWidget *item;
- GtkWidget *sep;
- guint pos = 0;
-
- item = gtk_check_menu_item_new_with_label (_("Case sensitive"));
- gtk_actionable_set_action_name (GTK_ACTIONABLE (item), "search-settings.case-sensitive");
- gtk_menu_shell_insert (GTK_MENU_SHELL (widget), item, pos++);
- gtk_widget_show (item);
-
- item = gtk_check_menu_item_new_with_label (_("Match whole word only"));
- gtk_actionable_set_action_name (GTK_ACTIONABLE (item), "search-settings.at-word-boundaries");
- gtk_menu_shell_insert (GTK_MENU_SHELL (widget), item, pos++);
- gtk_widget_show (item);
-
- item = gtk_check_menu_item_new_with_label (_("Wrap around"));
- gtk_actionable_set_action_name (GTK_ACTIONABLE (item), "search-settings.wrap-around");
- gtk_menu_shell_insert (GTK_MENU_SHELL (widget), item, pos++);
- gtk_widget_show (item);
-
- item = gtk_check_menu_item_new_with_label (_("Original text"));
- gtk_actionable_set_action_name (GTK_ACTIONABLE (item), "search-settings.at-original-text");
- gtk_menu_shell_insert (GTK_MENU_SHELL (widget), item, pos++);
- gtk_widget_show (item);
-
- item = gtk_check_menu_item_new_with_label (_("Translated text"));
- gtk_actionable_set_action_name (GTK_ACTIONABLE (item), "search-settings.at-translated-text");
- gtk_menu_shell_insert (GTK_MENU_SHELL (widget), item, pos++);
- gtk_widget_show (item);
-
- sep = gtk_separator_menu_item_new ();
- gtk_menu_shell_insert (GTK_MENU_SHELL (widget), sep, pos++);
- gtk_widget_show (sep);
-
- if (self->search != NULL)
- {
- group = dzl_properties_group_new (G_OBJECT (self->search));
- dzl_properties_group_add_all_properties (group);
- }
-
- gtk_widget_insert_action_group (widget, "search-settings", G_ACTION_GROUP (group));
- }
-}
-
static void
gtr_search_bar_real_stop_search (GtrSearchBar *self)
{
@@ -516,9 +456,6 @@ gtr_search_bar_destroy (GtkWidget *widget)
{
GtrSearchBar *self = (GtrSearchBar *)widget;
- dzl_clear_source (&self->match_source);
-
- g_clear_object (&self->search_signals);
g_clear_object (&self->search_bindings);
g_clear_object (&self->search);
g_clear_object (&self->search_entry_tag);
@@ -664,43 +601,39 @@ gtr_search_bar_init (GtrSearchBar *self)
(self->wrap_around_button),
TRUE);
-
- self->search_signals = dzl_signal_group_new (GTK_TYPE_SEARCH_ENTRY);
-
g_object_set (G_OBJECT (self->next_button), "can-default", TRUE, NULL);
- self->search_bindings = dzl_binding_group_new ();
+ self->search_bindings = g_binding_group_new ();
- dzl_binding_group_bind_full (self->search_bindings, "search-text",
- self->search_entry, "text",
- G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL,
- maybe_escape_regex, pacify_null_text, self, NULL);
+ g_binding_group_bind_full (self->search_bindings, "search-text",
+ self->search_entry, "text",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL,
+ maybe_escape_regex, pacify_null_text, self, NULL);
- dzl_binding_group_bind_full (self->search_bindings, "replacement-text",
- self->replace_entry, "text",
- G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL,
- pacify_null_text, pacify_null_text, NULL, NULL);
+ g_binding_group_bind_full (self->search_bindings, "replacement-text",
+ self->replace_entry, "text",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL,
+ pacify_null_text, pacify_null_text, NULL, NULL);
- dzl_binding_group_bind (self->search_bindings, "case-sensitive",
- self->case_sensitive, "active",
- G_BINDING_SYNC_CREATE |
- G_BINDING_BIDIRECTIONAL);
+ g_binding_group_bind (self->search_bindings, "case-sensitive",
+ self->case_sensitive, "active",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
- dzl_binding_group_bind (self->search_bindings, "at-word-boundaries",
- self->whole_word, "active",
- G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
+ g_binding_group_bind (self->search_bindings, "at-word-boundaries",
+ self->whole_word, "active",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
- dzl_binding_group_bind (self->search_bindings, "wrap-around",
- self->whole_word, "active",
- G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
+ g_binding_group_bind (self->search_bindings, "wrap-around",
+ self->whole_word, "active",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
- dzl_binding_group_bind (self->search_bindings, "at-original-text",
- self->whole_word, "active",
- G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
+ g_binding_group_bind (self->search_bindings, "at-original-text",
+ self->whole_word, "active",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
- dzl_binding_group_bind (self->search_bindings, "at-translated-text",
- self->whole_word, "active",
- G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
+ g_binding_group_bind (self->search_bindings, "at-translated-text",
+ self->whole_word, "active",
+ G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
g_signal_connect (self->search_entry,
"insert_text", G_CALLBACK (insert_text_handler), NULL);
@@ -723,11 +656,6 @@ gtr_search_bar_init (GtrSearchBar *self)
G_CALLBACK (gtr_search_bar_find_next),
self);
- g_signal_connect_swapped (self->search_entry,
- "populate-popup",
- G_CALLBACK (search_entry_populate_popup),
- self);
-
g_signal_connect_swapped (self->next_button,
"clicked",
G_CALLBACK (gtr_search_bar_find_next),
@@ -762,19 +690,6 @@ gtr_search_bar_get_search (GtrSearchBar *self)
return self->search;
}
-void
-gtr_search_bar_set_search (GtrSearchBar *self,
- GtkSearchEntry *search)
-{
- g_return_if_fail (GTR_IS_SEARCH_BAR (self));
-
- if (g_set_object (&self->search, search))
- {
- dzl_signal_group_set_target (self->search_signals, search);
- dzl_binding_group_set_source (self->search_bindings, search);
- }
-}
-
void
gtr_search_bar_set_found (GtrSearchBar *self,
gboolean found)
diff --git a/src/gtr-search-bar.h b/src/gtr-search-bar.h
index 329fe913..1df1ca9e 100644
--- a/src/gtr-search-bar.h
+++ b/src/gtr-search-bar.h
@@ -19,14 +19,13 @@
#pragma once
-#include <dazzle.h>
#include <gtksourceview/gtksource.h>
G_BEGIN_DECLS
#define GTR_TYPE_SEARCH_BAR (gtr_search_bar_get_type())
-G_DECLARE_FINAL_TYPE (GtrSearchBar, gtr_search_bar, GTR, SEARCH_BAR, DzlBin)
+G_DECLARE_FINAL_TYPE (GtrSearchBar, gtr_search_bar, GTR, SEARCH_BAR, GtkBin)
enum
{
diff --git a/src/gtr-search-bar.ui b/src/gtr-search-bar.ui
index f507187d..592cad30 100644
--- a/src/gtr-search-bar.ui
+++ b/src/gtr-search-bar.ui
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <template class="GtrSearchBar" parent="DzlBin">
+ <template class="GtrSearchBar" parent="GtkBin">
<style>
<class name="search-frame"/>
</style>
@@ -245,7 +245,7 @@
</child>
<child>
<object class="GtkCheckButton" id="original_text_checkbutton">
- <property name="label" translatable="yes">Original-text</property>
+ <property name="label" translatable="yes">Original text</property>
<property name="visible">true</property>
<property name="can-focus">false</property>
<property name="xalign">1</property>
@@ -258,7 +258,7 @@
</child>
<child>
<object class="GtkCheckButton" id="translated_text_checkbutton">
- <property name="label" translatable="yes">Translated-text</property>
+ <property name="label" translatable="yes">Translated text</property>
<property name="visible">true</property>
<property name="can-focus">false</property>
<property name="xalign">1</property>
diff --git a/src/styles.css b/src/styles.css
index 5440ea21..a55859aa 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -29,7 +29,7 @@
}
/* This file contains styling for various search widgets */
-.search-frame {
+.search-frame > box {
background-image: linear-gradient(shade(@theme_bg_color,1.05), @theme_bg_color);
padding: 6px;
border-style: solid;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]