Deprecate GtkStatusbar

The design patterns using statusbar are no longer popular,
and it is pretty easy to make a statusbar yourself with boxes
and labels, if you need one. The only thing special about
GtkStatusbar was its window resize handle, but that has
been gone for a long time.
This commit is contained in:
Matthias Clasen 2023-02-01 18:03:59 +01:00
parent 8796950651
commit d8cb11ec4a
15 changed files with 29 additions and 9 deletions

View File

@ -2,6 +2,8 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
typedef GtkApplication DemoApplication;
typedef GtkApplicationClass DemoApplicationClass;

View File

@ -37,6 +37,8 @@ remove_timeout (gpointer data)
g_source_remove (id);
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static gboolean
pop_status (gpointer data)
{
@ -57,6 +59,8 @@ status_message (GtkStatusbar *status,
g_object_set_data_full (G_OBJECT (status), "timeout", GUINT_TO_POINTER (id), remove_timeout);
}
G_GNUC_END_IGNORE_DEPRECATIONS
static void
help_activate (GSimpleAction *action,
GVariant *parameter,

View File

@ -2252,11 +2252,13 @@ activate (GApplication *app)
for (i = 0; i < G_N_ELEMENTS (accels); i++)
gtk_application_set_accels_for_action (GTK_APPLICATION (app), accels[i].action_and_target, accels[i].accelerators);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
widget = (GtkWidget *)gtk_builder_get_object (builder, "statusbar");
gtk_statusbar_push (GTK_STATUSBAR (widget), 0, "All systems are operating normally.");
action = G_ACTION (g_property_action_new ("statusbar", widget, "visible"));
g_action_map_add_action (G_ACTION_MAP (window), action);
g_object_unref (G_OBJECT (action));
G_GNUC_END_IGNORE_DEPRECATIONS
widget = (GtkWidget *)gtk_builder_get_object (builder, "toolbar");
action = G_ACTION (g_property_action_new ("toolbar", widget, "visible"));

View File

@ -109,3 +109,8 @@ Other libraries, such as libadwaita, may provide replacements as well.
## gtk_show_uri is being replaced
Instead of gtk_show_uri(), you should use GtkUriLauncher or GtkFileLauncher.
## GtkStatusbar is going away
This is an oldfashioned widget that does not do all that much anymore, since
it no longer has a resize handle for the window.

View File

@ -36,6 +36,8 @@
#include "gtktypebuiltins.h"
#include "gtkwidgetprivate.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/**
* GtkStatusbar:
*

View File

@ -42,23 +42,23 @@ typedef struct _GtkStatusbar GtkStatusbar;
GDK_AVAILABLE_IN_ALL
GType gtk_statusbar_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
GtkWidget* gtk_statusbar_new (void);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
guint gtk_statusbar_get_context_id (GtkStatusbar *statusbar,
const char *context_description);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
guint gtk_statusbar_push (GtkStatusbar *statusbar,
guint context_id,
const char *text);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_statusbar_pop (GtkStatusbar *statusbar,
guint context_id);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_statusbar_remove (GtkStatusbar *statusbar,
guint context_id,
guint message_id);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_10
void gtk_statusbar_remove_all (GtkStatusbar *statusbar,
guint context_id);

View File

@ -33,6 +33,7 @@ gtk_deprecated_sources = [
'deprecated/gtkliststore.c',
'deprecated/gtkrender.c',
'deprecated/gtkshow.c',
'deprecated/gtkstatusbar.c',
'deprecated/gtkstylecontext.c',
'deprecated/gtktreedatalist.c',
'deprecated/gtktreednd.c',
@ -90,6 +91,7 @@ gtk_deprecated_headers = [
'deprecated/gtkmessagedialog.h',
'deprecated/gtkrender.h',
'deprecated/gtkshow.h',
'deprecated/gtkstatusbar.h',
'deprecated/gtkstylecontext.h',
'deprecated/gtktreednd.h',
'deprecated/gtktreemodel.h',

View File

@ -252,7 +252,7 @@
#include <gtk/gtkspinner.h>
#include <gtk/gtkstack.h>
#include <gtk/gtkstackswitcher.h>
#include <gtk/gtkstatusbar.h>
#include <gtk/deprecated/gtkstatusbar.h>
#include <gtk/gtkstringfilter.h>
#include <gtk/gtkstringlist.h>
#include <gtk/gtkstringsorter.h>

View File

@ -360,7 +360,6 @@ gtk_public_sources = files([
'gtkstack.c',
'gtkstacksidebar.c',
'gtkstackswitcher.c',
'gtkstatusbar.c',
'gtkstringfilter.c',
'gtkstringlist.c',
'gtkstringsorter.c',
@ -593,7 +592,6 @@ gtk_public_headers = files([
'gtkstack.h',
'gtkstacksidebar.h',
'gtkstackswitcher.h',
'gtkstatusbar.h',
'gtkstringfilter.h',
'gtkstringlist.h',
'gtkstringsorter.h',

View File

@ -1,5 +1,7 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
GSList *pending = NULL;
guint active = 0;

View File

@ -1,5 +1,7 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
#define FILE_INFO_TYPE_SELECTION (file_info_selection_get_type ())
G_DECLARE_FINAL_TYPE (FileInfoSelection, file_info_selection, FILE_INFO, SELECTION, GObject)

View File

@ -17,6 +17,7 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
G_MODULE_EXPORT void
statusbar_remove_all (GtkStatusbar *s)