[gtk/kill-tree-menu: 9/43] gtk-demo: Remove a somewhat silly bit of code



commit 8efa6122886a3444bd64cbee09e5b57049c10260
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Dec 26 22:04:23 2019 -0500

    gtk-demo: Remove a somewhat silly bit of code
    
    Putting a context menu on an overlay scrollbar
    is too much of an easter egg to count as a useful
    demo. Remove it, rather than changing it to a
    popover.

 demos/gtk-demo/main.c | 45 ---------------------------------------------
 1 file changed, 45 deletions(-)
---
diff --git a/demos/gtk-demo/main.c b/demos/gtk-demo/main.c
index 6dc59da639..38288dc2b5 100644
--- a/demos/gtk-demo/main.c
+++ b/demos/gtk-demo/main.c
@@ -1003,32 +1003,6 @@ row_activated_cb (GtkWidget         *tree_view,
   run_example_for_row (window, model, &iter);
 }
 
-static void
-start_cb (GtkMenuItem *item, GtkWidget *scrollbar)
-{
-  GtkAdjustment *adj;
-
-  adj = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (scrollbar));
-  gtk_adjustment_set_value (adj, gtk_adjustment_get_lower (adj));
-}
-
-static void
-end_cb (GtkMenuItem *item, GtkWidget *scrollbar)
-{
-  GtkAdjustment *adj;
-
-  adj = gtk_scrollbar_get_adjustment (GTK_SCROLLBAR (scrollbar));
-  gtk_adjustment_set_value (adj, gtk_adjustment_get_upper (adj) - gtk_adjustment_get_page_size (adj));
-}
-
-static gboolean
-scrollbar_popup (GtkWidget *scrollbar, GtkWidget *menu)
-{
-  gtk_menu_popup_at_pointer (GTK_MENU (menu), NULL);
-
-  return TRUE;
-}
-
 static void
 activate (GApplication *app)
 {
@@ -1037,10 +1011,6 @@ activate (GApplication *app)
   GtkWidget *widget;
   GtkTreeModel *model;
   GtkTreeIter iter;
-  GtkWidget *sw;
-  GtkWidget *scrollbar;
-  GtkWidget *menu;
-  GtkWidget *item;
 
   static GActionEntry win_entries[] = {
     { "run", activate_run, NULL, NULL, NULL }
@@ -1062,21 +1032,6 @@ activate (GApplication *app)
   treeview = (GtkWidget *)gtk_builder_get_object (builder, "treeview");
   model = gtk_tree_view_get_model (GTK_TREE_VIEW (treeview));
 
-  sw = (GtkWidget *)gtk_builder_get_object (builder, "source-scrolledwindow");
-  scrollbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (sw));
-
-  menu = gtk_menu_new ();
-
-  item = gtk_menu_item_new_with_label ("Start");
-  g_signal_connect (item, "activate", G_CALLBACK (start_cb), scrollbar);
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
-  item = gtk_menu_item_new_with_label ("End");
-  g_signal_connect (item, "activate", G_CALLBACK (end_cb), scrollbar);
-  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
-  g_signal_connect (scrollbar, "popup-menu", G_CALLBACK (scrollbar_popup), menu);
-
   load_file (gtk_demos[0].name, gtk_demos[0].filename);
 
   populate_model (model);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]