[gtk+/wip/csd-for-review] Add min and max buttons
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/csd-for-review] Add min and max buttons
- Date: Mon, 11 Mar 2013 02:03:01 +0000 (UTC)
commit ca849344f1e4dc62b436dd91207dfdbe6541127d
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Mar 9 22:02:52 2013 -0500
Add min and max buttons
gtk/gtkwindow.c | 38 +++++++++++++++++++++++++++++++++++++-
1 files changed, 37 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index d00a8a7..0c4687e 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -143,6 +143,8 @@ struct _GtkWindowPrivate
GtkWidget *title_box;
GtkWidget *title_label;
+ GtkWidget *title_min_button;
+ GtkWidget *title_max_button;
GtkWidget *title_close_button;
/* The following flags are initially TRUE (before a window is mapped).
@@ -1158,6 +1160,26 @@ gtk_window_class_init (GtkWindowClass *klass)
}
static void
+gtk_window_title_min_clicked (GtkWidget *widget, gpointer data)
+{
+ GtkWindow *window = (GtkWindow *)data;
+
+ gtk_window_iconify (window);
+}
+
+static void
+gtk_window_title_max_clicked (GtkWidget *widget, gpointer data)
+{
+ GtkWindow *window = (GtkWindow *)data;
+ GdkWindowState state = gdk_window_get_state (gtk_widget_get_window (widget));
+
+ if (state & GDK_WINDOW_STATE_MAXIMIZED)
+ gtk_window_unmaximize (window);
+ else
+ gtk_window_maximize (window);
+}
+
+static void
gtk_window_title_close_clicked (GtkWidget *button, void *data)
{
/* Synthesize delete_event to close dialog. */
@@ -4873,7 +4895,7 @@ create_decoration (GtkWidget *widget)
if (priv->type != GTK_WINDOW_POPUP)
{
- priv->title_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
+ priv->title_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
context = gtk_widget_get_style_context (priv->title_box);
gtk_style_context_add_class (context, "titlebar");
gtk_widget_set_parent (priv->title_box, GTK_WIDGET (window));
@@ -4892,6 +4914,20 @@ create_decoration (GtkWidget *widget)
FALSE, FALSE, 0);
g_signal_connect (priv->title_close_button, "clicked",
G_CALLBACK (gtk_window_title_close_clicked), window);
+
+ priv->title_max_button = gtk_button_new_with_label ("\342\226\253");
+
+ gtk_box_pack_end (GTK_BOX (priv->title_box), priv->title_max_button,
+ FALSE, FALSE, 0);
+ g_signal_connect (priv->title_max_button, "clicked",
+ G_CALLBACK (gtk_window_title_max_clicked), window);
+
+ priv->title_min_button = gtk_button_new_with_label ("_");
+ gtk_box_pack_end (GTK_BOX (priv->title_box), priv->title_min_button,
+ FALSE, FALSE, 0);
+ g_signal_connect (priv->title_min_button, "clicked",
+ G_CALLBACK (gtk_window_title_min_clicked), window);
+
gtk_widget_show_all (priv->title_box);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]