[gedit/wip/redesign2: 15/19] Make fullscreen a toggle



commit 30448e5b87119a6f6a39d7b6e3276930d7f04dac
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Jan 4 12:25:27 2014 +0100

    Make fullscreen a toggle

 gedit/gedit-commands-view.c |   14 ++++++++++----
 gedit/gedit-commands.h      |    2 +-
 gedit/gedit-window.c        |    2 +-
 3 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/gedit/gedit-commands-view.c b/gedit/gedit-commands-view.c
index 5074ab3..b158fe2 100644
--- a/gedit/gedit-commands-view.c
+++ b/gedit/gedit-commands-view.c
@@ -92,17 +92,23 @@ _gedit_cmd_view_toggle_bottom_panel (GSimpleAction *action,
 
 void
 _gedit_cmd_view_toggle_fullscreen_mode (GSimpleAction *action,
-                                        GVariant      *parameter,
+                                        GVariant      *state,
                                         gpointer       user_data)
 {
        GeditWindow *window = GEDIT_WINDOW (user_data);
 
        gedit_debug (DEBUG_COMMANDS);
 
-       if (_gedit_window_is_fullscreen (window))
-               _gedit_window_unfullscreen (window);
-       else
+       if (g_variant_get_boolean (state))
+       {
                _gedit_window_fullscreen (window);
+       }
+       else
+       {
+               _gedit_window_unfullscreen (window);
+       }
+
+       g_simple_action_set_state (action, state);
 }
 
 void
diff --git a/gedit/gedit-commands.h b/gedit/gedit-commands.h
index f805a1f..a671e5e 100644
--- a/gedit/gedit-commands.h
+++ b/gedit/gedit-commands.h
@@ -137,7 +137,7 @@ void                _gedit_cmd_view_toggle_bottom_panel     (GSimpleAction *action,
                                                          GVariant      *state,
                                                          gpointer       user_data);
 void           _gedit_cmd_view_toggle_fullscreen_mode  (GSimpleAction *action,
-                                                         GVariant      *parameter,
+                                                         GVariant      *state,
                                                          gpointer       user_data);
 void           _gedit_cmd_view_leave_fullscreen_mode   (GSimpleAction *action,
                                                          GVariant      *parameter,
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index e8d705f..8501a76 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -3208,7 +3208,7 @@ static GActionEntry win_entries[] = {
        { "close", _gedit_cmd_file_close },
        { "side_panel", activate_toggle, NULL, "false", _gedit_cmd_view_toggle_side_panel },
        { "bottom_panel", activate_toggle, NULL, "false", _gedit_cmd_view_toggle_bottom_panel },
-       { "fullscreen", _gedit_cmd_view_toggle_fullscreen_mode },
+       { "fullscreen", activate_toggle, NULL, "false", _gedit_cmd_view_toggle_fullscreen_mode },
        { "leave_fullscreen", _gedit_cmd_view_leave_fullscreen_mode },
        { "find", _gedit_cmd_search_find },
        { "find_next", _gedit_cmd_search_find_next },


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