]> Pileus Git - ~andy/gtk/commitdiff
Drop GtkApplicationMenuButton for now
authorMatthias Clasen <mclasen@redhat.com>
Thu, 1 Dec 2011 17:17:53 +0000 (12:17 -0500)
committerRyan Lortie <desrt@desrt.ca>
Mon, 19 Dec 2011 17:51:09 +0000 (12:51 -0500)
This feels premature; we do have the fallback situation covered
adaequately with the menubar, and people can do their own creative
solutions with gtk_application_window_get_menu(), so we don't have
to offer a widget for this right now.

docs/reference/gtk/gtk-docs.sgml
docs/reference/gtk/gtk3-sections.txt
docs/reference/gtk/gtk3.types
examples/bloatpad.c
gtk/Makefile.am
gtk/gtk.h
gtk/gtkapplicationmenubutton.c [deleted file]
gtk/gtkapplicationmenubutton.h [deleted file]

index b0b0ffdd2b66ad2e0bbb1962b981f5053fb1d290..5ad00b3c3893e0bf34c3bc96e22c27c1a2ef60bc 100644 (file)
       <title>Application support</title>
       <xi:include href="xml/gtkapplication.xml" />
       <xi:include href="xml/gtkapplicationwindow.xml" />
-      <xi:include href="xml/gtkapplicationmenubutton.xml" />
     </chapter>
   </part>
 
index fd868da0e5a2164e6be0d1e26536c1b645ba9932..6d83478685461c63a3d1f9750c45664bd5577534 100644 (file)
@@ -7042,21 +7042,6 @@ gtk_application_window_get_type
 GtkApplicationWindowPrivate
 </SECTION>
 
-<SECTION>
-<FILE>gtkapplicationmenubutton</FILE>
-<TITLE>GtkApplicationMenuButton</TITLE>
-GtkApplicationMenuButton
-gtk_application_menu_button_new
-
-<SUBSECTION Standard>
-GTK_TYPE_APPLICATION_MENU_BUTTON
-GTK_APPLICATION_MENU_BUTTON
-GTK_IS_APPLICATION_MENU_BUTTON
-
-<SUBSECTION Private>
-gtk_application_menu_button_get_type
-</SECTION>
-
 <SECTION>
 <FILE>gtkgrid</FILE>
 <TITLE>GtkGrid</TITLE>
index 1153539aadc90af1510f9668f3f4a3397d949b2a..4a035af995c7fbaf34cee2e68815cabe9aa4f3c2 100644 (file)
@@ -17,7 +17,6 @@ gtk_app_chooser_dialog_get_type
 gtk_app_chooser_widget_get_type
 gtk_application_get_type
 gtk_application_window_get_type
-gtk_application_menu_button_get_type
 gtk_arrow_get_type
 gtk_aspect_frame_get_type
 gtk_assistant_get_type
index 4632c39c16a23a506372ce452268491a409094af..315ec12a65db9c4b6f81794b074d0cdfd151e130 100644 (file)
@@ -49,7 +49,7 @@ static void
 new_window (GApplication *app,
             GFile        *file)
 {
-  GtkWidget *window, *button, *grid, *scrolled, *view;
+  GtkWidget *window, *grid, *scrolled, *view;
 
   window = gtk_application_window_new (GTK_APPLICATION (app));
   g_action_map_add_action_entries (G_ACTION_MAP (window), win_entries, G_N_ELEMENTS (win_entries), window);
@@ -58,11 +58,6 @@ new_window (GApplication *app,
   grid = gtk_grid_new ();
   gtk_container_add (GTK_CONTAINER (window), grid);
 
-  button = gtk_application_menu_button_new ();
-  gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_icon_name ("help-about", GTK_ICON_SIZE_MENU));
-  gtk_widget_set_halign (button, GTK_ALIGN_START);
-  gtk_grid_attach (GTK_GRID (grid), button, 0, 0, 1, 1);
-
   scrolled = gtk_scrolled_window_new (NULL, NULL);
   gtk_widget_set_hexpand (scrolled, TRUE);
   gtk_widget_set_vexpand (scrolled, TRUE);
@@ -70,7 +65,7 @@ new_window (GApplication *app,
 
   gtk_container_add (GTK_CONTAINER (scrolled), view);
 
-  gtk_grid_attach (GTK_GRID (grid), scrolled, 0, 1, 1, 1);
+  gtk_grid_attach (GTK_GRID (grid), scrolled, 0, 0, 1, 1);
 
   if (file != NULL)
     {
index f84d23a2d4fb20a84ad503c18918d3a1fcbd1d42..aad7bc7103e358c81468e4a60ec1512203fc2777 100644 (file)
@@ -183,7 +183,6 @@ gtk_public_h_sources =              \
        gtkappchooserwidget.h   \
        gtkapplication.h        \
        gtkapplicationwindow.h  \
-       gtkapplicationmenubutton.h      \
        gtkarrow.h              \
        gtkaspectframe.h        \
        gtkassistant.h          \
@@ -533,7 +532,6 @@ gtk_base_c_sources =                \
        gtkappchooseronline.c   \
        gtkapplication.c        \
        gtkapplicationwindow.c  \
-       gtkapplicationmenubutton.c      \
        gtkanimationdescription.c \
        gtkarrow.c              \
        gtkaspectframe.c        \
index 5849569d1392205721fff86b8481ebe875f3091c..0668636fc055a53216ff6d785dcc85083288aefd 100644 (file)
--- a/gtk/gtk.h
+++ b/gtk/gtk.h
@@ -45,7 +45,6 @@
 #include <gtk/gtkappchooserwidget.h>
 #include <gtk/gtkappchooserbutton.h>
 #include <gtk/gtkapplication.h>
-#include <gtk/gtkapplicationmenubutton.h>
 #include <gtk/gtkapplicationwindow.h>
 #include <gtk/gtkarrow.h>
 #include <gtk/gtkaspectframe.h>
diff --git a/gtk/gtkapplicationmenubutton.c b/gtk/gtkapplicationmenubutton.c
deleted file mode 100644 (file)
index add0f38..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * Copyright © 2011 Canonical Ltd.
- *
- * 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
- * licence, 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- *
- * Author: Ryan Lortie <desrt@desrt.ca>
- */
-
-#include "config.h"
-
-#include "gtkapplicationmenubutton.h"
-
-#include "gtkapplicationwindow.h"
-#include "gtkbutton.h"
-#include "gtkmain.h"
-
-#include <string.h>
-
-/**
- * SECTION:gtkapplicationmenubutton
- * @title: GtkApplicationMenuButton
- * @short_description: A button that shows the application menu
- *
- * A GtkApplicationMenuButton can be added to a #GtkApplicationWindow
- * as an alternative way to present the application menu, if it is
- * not shown by the desktop environment. GtkApplicationMenuButton
- * automatically hides itself, and only appears when necessary. It
- * is derived from #GtkButton, and you should use regular #GtkButton
- * API to add a suitable icon or label. Note that #GtkApplicationWindow
- * already provides a way to present the application menu, so a
- * #GtkApplicationMenuButton is only needed if the default
- * appearance (as part of a menubar) is not suitable.
- *
- * To configure the contents of the application menu, use
- * g_application_set_menu() and g_application_set_action_group() on
- * the #GtkApplication associated with the #GtkApplicationWindow.
- */
-
-struct _GtkApplicationMenuButton
-{
-  GtkButton parent_instance;
-
-  GtkSettings *settings;
-
-  gboolean user_shown;
-  gboolean required;
-};
-
-typedef GtkButtonClass GtkApplicationMenuButtonClass;
-
-G_DEFINE_TYPE (GtkApplicationMenuButton, gtk_application_menu_button, GTK_TYPE_BUTTON)
-
-static void
-gtk_application_menu_update_visibility (GtkApplicationMenuButton *amb)
-{
-  GtkWidget *widget = GTK_WIDGET (amb);
-  gboolean should_be_visible;
-  gboolean was_visible;
-
-  should_be_visible = amb->user_shown && amb->required;
-  was_visible = gtk_widget_get_visible (widget);
-
-  if (!was_visible && should_be_visible)
-    GTK_WIDGET_CLASS (gtk_application_menu_button_parent_class)->show (widget);
-
-  else if (was_visible && !should_be_visible)
-    GTK_WIDGET_CLASS (gtk_application_menu_button_parent_class)->hide (widget);
-}
-
-static void
-gtk_application_menu_button_clicked (GtkButton *button)
-{
-  GtkWidget *toplevel;
-
-  toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button));
-  if (toplevel != NULL && GTK_IS_APPLICATION_WINDOW (toplevel))
-    {
-      GtkWidget *menu;
-
-      menu = gtk_application_window_get_app_menu (GTK_APPLICATION_WINDOW (toplevel));
-      gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL,
-                      1, gtk_get_current_event_time ());
-    }
-}
-
-static void
-gtk_application_menu_button_show (GtkWidget *widget)
-{
-  GtkApplicationMenuButton *amb = GTK_APPLICATION_MENU_BUTTON (widget);
-
-  amb->user_shown = TRUE;
-
-  gtk_application_menu_update_visibility (amb);
-}
-
-static void
-gtk_application_menu_button_hide (GtkWidget *widget)
-{
-  GtkApplicationMenuButton *amb = GTK_APPLICATION_MENU_BUTTON (widget);
-
-  amb->user_shown = FALSE;
-
-  gtk_application_menu_update_visibility (amb);
-}
-
-static void
-gtk_application_menu_button_show_all (GtkWidget *widget)
-{
-  GtkApplicationMenuButton *amb = GTK_APPLICATION_MENU_BUTTON (widget);
-
-  gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) gtk_widget_show_all, NULL);
-  amb->user_shown = TRUE;
-
-  gtk_application_menu_update_visibility (amb);
-}
-
-static void
-gtk_application_menu_button_required_changed (GObject    *object,
-                                              GParamSpec *pspec,
-                                              gpointer    user_data)
-{
-  GtkApplicationMenuButton *amb = user_data;
-  gboolean required;
-
-  g_object_get (object, "gtk-shell-shows-app-menu", &required, NULL);
-  required = !required;
-
-  if (required != amb->required)
-    {
-      amb->required = required;
-
-      gtk_application_menu_update_visibility (amb);
-    }
-}
-
-static void
-gtk_application_menu_button_screen_changed (GtkWidget *widget,
-                                            GdkScreen *old_screen)
-{
-  GtkApplicationMenuButton *amb = GTK_APPLICATION_MENU_BUTTON (widget);
-  GtkSettings *settings;
-  GdkScreen *screen;
-
-  screen = gtk_widget_get_screen (widget);
-  settings = gtk_settings_get_for_screen (screen);
-
-  if (settings != amb->settings)
-    {
-      if (amb->settings)
-        {
-          g_signal_handlers_disconnect_by_func (amb->settings, gtk_application_menu_button_required_changed, amb);
-          g_object_unref (amb->settings);
-        }
-
-      amb->settings = g_object_ref (settings);
-      g_signal_connect (amb->settings, "notify::gtk-shell-shows-app-menu",
-                        G_CALLBACK (gtk_application_menu_button_required_changed), amb);
-      gtk_application_menu_button_required_changed (G_OBJECT (settings), NULL, amb);
-    }
-}
-
-static void
-gtk_application_menu_button_hierarchy_changed (GtkWidget *widget,
-                                               GtkWidget *previous_toplevel)
-{
-  GtkWidget *toplevel;
-
-  toplevel = gtk_widget_get_toplevel (widget);
-
-  if (GTK_IS_APPLICATION_WINDOW (toplevel))
-    gtk_application_window_set_show_app_menu (GTK_APPLICATION_WINDOW (toplevel), FALSE);
-}
-
-static void
-gtk_application_menu_button_finalize (GObject *object)
-{
-  GtkApplicationMenuButton *amb = GTK_APPLICATION_MENU_BUTTON (object);
-
-  if (amb->settings)
-    {
-      g_signal_handlers_disconnect_by_func (amb->settings, gtk_application_menu_button_required_changed, amb);
-      g_object_unref (amb->settings);
-    }
-
-  G_OBJECT_CLASS (gtk_application_menu_button_parent_class)
-    ->finalize (object);
-}
-
-static void
-gtk_application_menu_button_init (GtkApplicationMenuButton *menu)
-{
-}
-
-static void
-gtk_application_menu_button_class_init (GtkApplicationMenuButtonClass *class)
-{
-  GtkButtonClass *button_class = GTK_BUTTON_CLASS (class);
-  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
-  GObjectClass *object_class = G_OBJECT_CLASS (class);
-
-  button_class->clicked = gtk_application_menu_button_clicked;
-
-  widget_class->show = gtk_application_menu_button_show;
-  widget_class->show_all = gtk_application_menu_button_show_all;
-  widget_class->hide = gtk_application_menu_button_hide;
-  widget_class->screen_changed = gtk_application_menu_button_screen_changed;
-  widget_class->hierarchy_changed = gtk_application_menu_button_hierarchy_changed;
-
-  object_class->finalize = gtk_application_menu_button_finalize;
-}
-
-/**
- * gtk_application_menu_button_new:
- *
- * Creates a new #GtkApplicationMenuButton.
- *
- * Returns: a newly created #GtkApplicationMenuButton
- *
- * Since: 3.4
- */
-GtkWidget *
-gtk_application_menu_button_new (void)
-{
-  return g_object_new (GTK_TYPE_APPLICATION_MENU_BUTTON, NULL);
-}
diff --git a/gtk/gtkapplicationmenubutton.h b/gtk/gtkapplicationmenubutton.h
deleted file mode 100644 (file)
index 450940a..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright © 2011 Canonical Ltd.
- *
- * 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
- * licence, 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- *
- * Author: Ryan Lortie <desrt@desrt.ca>
- */
-
-#ifndef __GTK_APPLICATION_MENU_BUTTON_H__
-#define __GTK_APPLICATION_MENU_BUTTON_H__
-
-#include <gtk/gtkwidget.h>
-
-G_BEGIN_DECLS
-
-#define GTK_TYPE_APPLICATION_MENU_BUTTON     (gtk_application_menu_button_get_type ())
-#define GTK_APPLICATION_MENU_BUTTON(inst)    (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
-                                              GTK_TYPE_APPLICATION_MENU_BUTTON,   \
-                                              GtkApplicationMenuButton))
-#define GTK_IS_APPLICATION_MENU_BUTTON(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
-                                              GTK_TYPE_APPLICATION_MENU_BUTTON))
-
-typedef struct _GtkApplicationMenuButton GtkApplicationMenuButton;
-
-GType       gtk_application_menu_button_get_type (void) G_GNUC_CONST;
-
-GtkWidget * gtk_application_menu_button_new      (void);
-
-G_END_DECLS
-
-#endif /* __GTK_APPLICATION_MENU_BUTTON_H__ */