[gtk-mac-integration] Revert "Suppress NULL object warning in cocoa_menu_item_update_accel_closure"



commit 8d176115a6ddbd37de7514f7633c9e8736cb0382
Author: John Ralls <jralls ceridwen us>
Date:   Sat Jul 6 15:48:51 2013 -0700

    Revert "Suppress NULL object warning in cocoa_menu_item_update_accel_closure"
    
    This reverts commit 32bb85d44e62a5dc3061753fa739f962b0441fb7.
    Picked up too many changes...

 src/cocoa_menu_item.c          |   18 ++++++++----------
 src/gtkosxapplication_quartz.c |   13 ++-----------
 src/gtkosxapplicationprivate.h |    1 -
 src/test-integration.c         |   19 -------------------
 4 files changed, 10 insertions(+), 41 deletions(-)
---
diff --git a/src/cocoa_menu_item.c b/src/cocoa_menu_item.c
index 025c409..8068039 100644
--- a/src/cocoa_menu_item.c
+++ b/src/cocoa_menu_item.c
@@ -342,10 +342,10 @@ cocoa_menu_item_update_accel_closure (_GNSMenuItem *cocoa_item,
   if (cocoa_item->accel_closure)
     {
       group = gtk_accel_group_from_accel_closure (cocoa_item->accel_closure);
-      if (group)
-       g_signal_handlers_disconnect_by_func (group,
-                                             (void*) cocoa_menu_item_accel_changed,
-                                             widget);
+
+      g_signal_handlers_disconnect_by_func (group,
+                                            (void*) cocoa_menu_item_accel_changed,
+                                            widget);
 
       g_closure_unref (cocoa_item->accel_closure);
       cocoa_item->accel_closure = NULL;
@@ -361,10 +361,10 @@ cocoa_menu_item_update_accel_closure (_GNSMenuItem *cocoa_item,
       g_closure_ref (cocoa_item->accel_closure);
 
       group = gtk_accel_group_from_accel_closure (cocoa_item->accel_closure);
-      if (group)
-       g_signal_connect_object (group, "accel-changed",
-                                G_CALLBACK (cocoa_menu_item_accel_changed),
-                                widget, (GConnectFlags) 0);
+
+      g_signal_connect_object (group, "accel-changed",
+                               G_CALLBACK (cocoa_menu_item_accel_changed),
+                               widget, (GConnectFlags) 0);
     }
 
   cocoa_menu_item_update_accelerator (cocoa_item, widget);
@@ -517,7 +517,6 @@ cocoa_menu_item_add_item_image (_GNSMenuItem* cocoa_item, GtkWidget* menu_item)
     [cocoa_item setImage: image];
 }
 #endif
-
 /*
  * Public Functions
  */
@@ -654,7 +653,6 @@ cocoa_menu_item_add_submenu (GtkMenuShell *menu_shell,
         continue;
       /*OK, this must be a new one. Add it. */
       cocoa_menu_item_add_item (cocoa_menu, menu_item, index++);
-
     }
   /* Iterate over the cocoa menu again removing anything that's still marked */
   for (index = 0; index < [cocoa_menu numberOfItems]; index++)
diff --git a/src/gtkosxapplication_quartz.c b/src/gtkosxapplication_quartz.c
index c96eb51..0386c39 100644
--- a/src/gtkosxapplication_quartz.c
+++ b/src/gtkosxapplication_quartz.c
@@ -217,11 +217,8 @@ create_apple_menu (GtkosxApplication *self)
   [menuitem setTarget: NSApp];
   [app_menu addItem: menuitem];
   [menuitem release];
-  if (!self->priv->app_menu_set)
-    {
-      [NSApp performSelector: @selector (setAppleMenu: ) withObject: app_menu];
-      self->priv->app_menu_set = TRUE;
-    }
+
+  [NSApp performSelector: @selector (setAppleMenu: ) withObject: app_menu];
   return add_to_menubar (self, app_menu, 0);
 }
 
@@ -486,7 +483,6 @@ gtkosx_application_init (GtkosxApplication *self)
   self->priv->notify = [[GtkApplicationNotificationObject alloc] init];
   [NSApp setDelegate: [GtkApplicationDelegate new]];
   self->priv->delegate = [NSApp delegate];
-  self->priv->app_menu_set = FALSE;
 }
 
 static void
@@ -617,11 +613,6 @@ gtkosx_application_class_init (GtkosxApplicationClass *klass)
 void
 gtkosx_application_ready (GtkosxApplication *self)
 {
-  if (!self->priv->app_menu_set)
-    {
-      create_apple_menu (self);
-      self->priv->app_menu_set = TRUE;
-    }
   [NSApp finishLaunching];
 }
 
diff --git a/src/gtkosxapplicationprivate.h b/src/gtkosxapplicationprivate.h
index 145f338..bf9cf25 100644
--- a/src/gtkosxapplicationprivate.h
+++ b/src/gtkosxapplicationprivate.h
@@ -37,7 +37,6 @@ struct _GtkosxApplicationPrivate
   NSMenu *dock_menu;
   GtkApplicationNotificationObject *notify;
   GtkApplicationDelegate *delegate;
-  gboolean app_menu_set;
 };
 
 #endif
diff --git a/src/test-integration.c b/src/test-integration.c
index 33866c1..0d6678b 100644
--- a/src/test-integration.c
+++ b/src/test-integration.c
@@ -459,15 +459,6 @@ change_icon_cb (GtkWidget  *button,
 {
 }
 #endif //GTKMACINTEGRATION
-static void
-window_change_title_cb (GtkWidget *button, gpointer user_data)
-{
-  GtkWidget *window = gtk_widget_get_toplevel (button);
-  gchar *old_title = gtk_window_get_title (GTK_WINDOW (window));
-  gchar *new_title = g_strdup_printf ("New %s", old_title);
-  gtk_window_set_title (GTK_WINDOW (window), new_title);
-  g_free (new_title);
-}
 
 static void
 change_menu_cb (GtkWidget  *button,
@@ -715,13 +706,6 @@ create_window (const gchar *title)
                       button,
                       FALSE, FALSE, 0);
 
-  button = gtk_button_new_with_label ("Change Title");
-  g_signal_connect (button, "clicked", G_CALLBACK (window_change_title_cb),
-                   NULL);
-  gtk_box_pack_start (GTK_BOX (bbox),
-                      button,
-                      FALSE, FALSE, 0);
-
   gtk_widget_show_all (window);
 #if defined GTK_MAC_MENU || defined GTKOSXAPPLICATION
   gtk_widget_hide (menubar);
@@ -767,8 +751,6 @@ create_window (const gchar *title)
     menu_items_quark = g_quark_from_static_string ("MenuItem");
   g_object_set_qdata_full (G_OBJECT (window), menu_items_quark,
                            items, (GDestroyNotify)menu_items_destroy);
-  //  gtk_widget_set_sensitive(items->preferences_item, FALSE);
-  g_object_set (items->preferences_item, "visible", FALSE, NULL);
   return window;
 }
 
@@ -830,7 +812,6 @@ main (int argc, char **argv)
   gtkosx_application_set_use_quartz_accelerators (theApp, FALSE);
 # endif //QUARTZ_HANDLERS
   gtkosx_application_ready (theApp);
-
   {
     const gchar *id = gtkosx_application_get_bundle_id ();
     if (id != NULL)



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