[gnome-bluetooth] lib: Adapt to GtkWindow API changes
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] lib: Adapt to GtkWindow API changes
- Date: Thu, 28 Oct 2021 15:29:58 +0000 (UTC)
commit 838b5109cf689938cf7decbfb201e20f7e327ab5
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Oct 27 13:30:29 2021 -0300
lib: Adapt to GtkWindow API changes
- gtk_window_new() doesn't have any construct-time arguments anymore
- The 'hide-on-close' property replaces the 'destroy-event' callback
lib/bluetooth-pairing-dialog.ui | 1 -
lib/bluetooth-settings-widget.c | 3 +--
lib/test-client.c | 15 ++-------------
lib/test-settings.c | 15 ++-------------
4 files changed, 5 insertions(+), 29 deletions(-)
---
diff --git a/lib/bluetooth-pairing-dialog.ui b/lib/bluetooth-pairing-dialog.ui
index 3c926e9b..03f4f37f 100644
--- a/lib/bluetooth-pairing-dialog.ui
+++ b/lib/bluetooth-pairing-dialog.ui
@@ -4,7 +4,6 @@
<requires lib="gtk+" version="3.12"/>
<template class="BluetoothPairingDialog" parent="GtkDialog">
<property name="can_focus">False</property>
- <property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
diff --git a/lib/bluetooth-settings-widget.c b/lib/bluetooth-settings-widget.c
index f55428aa..089cac2e 100644
--- a/lib/bluetooth-settings-widget.c
+++ b/lib/bluetooth-settings-widget.c
@@ -1810,12 +1810,11 @@ setup_properties_dialog (BluetoothSettingsWidget *self)
GtkStyleContext *context;
priv->properties_dialog = g_object_new (GTK_TYPE_DIALOG, "use-header-bar", TRUE, NULL);
+ gtk_window_set_hide_on_close (GTK_WINDOW (priv->properties_dialog), TRUE);
gtk_widget_set_size_request (priv->properties_dialog, 380, -1);
gtk_window_set_resizable (GTK_WINDOW (priv->properties_dialog), FALSE);
gtk_window_set_child (GTK_WINDOW (priv->properties_dialog), WID ("properties_vbox"));
- g_signal_connect (G_OBJECT (priv->properties_dialog), "delete-event",
- G_CALLBACK (gtk_widget_hide_on_delete), NULL);
g_signal_connect (G_OBJECT (WID ("delete_button")), "clicked",
G_CALLBACK (delete_clicked), self);
g_signal_connect (G_OBJECT (WID ("mouse_button")), "clicked",
diff --git a/lib/test-client.c b/lib/test-client.c
index 03439ce8..288a7712 100644
--- a/lib/test-client.c
+++ b/lib/test-client.c
@@ -35,14 +35,6 @@
static BluetoothClient *client;
static GtkTreeSelection *selection;
-static void delete_callback(GtkWidget *window, GdkEvent *event,
- gpointer user_data)
-{
- gtk_window_destroy(GTK_WINDOW(window));
-
- gtk_main_quit();
-}
-
static void scan_callback(GtkWidget *button, gpointer user_data)
{
g_object_set (G_OBJECT (client), "default-adapter-discovering", TRUE, NULL);
@@ -150,13 +142,10 @@ static void create_window(void)
GtkTreeModel *sorted;
GtkWidget *statusbar;
- window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ window = gtk_window_new();
gtk_window_set_title(GTK_WINDOW(window), "Test client");
gtk_window_set_icon_name(GTK_WINDOW(window), "bluetooth");
- gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);
- g_signal_connect(G_OBJECT(window), "delete-event",
- G_CALLBACK(delete_callback), NULL);
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_window_set_child(GTK_WINDOW(window), vbox);
@@ -257,7 +246,7 @@ static void create_window(void)
statusbar = gtk_statusbar_new();
gtk_box_pack_start(GTK_BOX(vbox), statusbar, FALSE, FALSE, 0);
- gtk_widget_show_all(window);
+ gtk_window_present(GTK_WINDOW(window));
}
static void
diff --git a/lib/test-settings.c b/lib/test-settings.c
index e0595c38..3d995399 100644
--- a/lib/test-settings.c
+++ b/lib/test-settings.c
@@ -1,30 +1,19 @@
#include "bluetooth-settings-widget.h"
-static gboolean
-delete_event_cb (GtkWidget *widget,
- GdkEvent *event,
- gpointer user_data)
-{
- gtk_main_quit ();
- return FALSE;
-}
-
int main (int argc, char **argv)
{
GtkWidget *window, *widget;
gtk_init ();
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ window = gtk_window_new ();
gtk_widget_set_size_request (window, 300, 600);
gtk_window_set_default_size (GTK_WINDOW (window), 800, -1);
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
- g_signal_connect (G_OBJECT (window), "delete-event",
- G_CALLBACK (delete_event_cb), NULL);
widget = bluetooth_settings_widget_new ();
gtk_window_set_child (GTK_WINDOW (window), widget);
- gtk_widget_show_all (window);
+ gtk_window_present(GTK_WINDOW(window));
gtk_main ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]