Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Global settings are the settings that affect the entire desktop. Local settings are the settings that affect the window. They share the same schema, defined in settings.vala Local settings override global settings according to the logic defined in local-settings.vala globalmenu-settings accepts -w commandline argument, to specify the windwo for which the local setting is modifed.
- Loading branch information
1 parent
bf85f73
commit 7990db9
Showing
8 changed files
with
199 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
public class Gnomenu.GlobalSettings : Gnomenu.Settings { | ||
public Gdk.Screen screen {get; private set;} | ||
public new static Gnomenu.GlobalSettings get(Gdk.Screen screen) { | ||
Gnomenu.GlobalSettings * settings = screen.get_data("globalmenu-settings"); | ||
if(settings != null) return settings; | ||
return new GlobalSettings(screen); | ||
} | ||
public GlobalSettings(Gdk.Screen? screen = null) { | ||
attach_to_screen(screen); | ||
screen.set_data_full("globalmenu-settings", this.ref(), g_object_unref); | ||
} | ||
|
||
public void attach_to_screen(Gdk.Screen? screen) { | ||
this.screen = screen; | ||
if(this.screen == null) | ||
attach_to_window(null); | ||
else | ||
attach_to_window(this.screen.get_root_window()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
public class Gnomenu.LocalSettings : Gnomenu.Settings { | ||
public Gnomenu.GlobalSettings global {get; private set;} | ||
|
||
public override bool show_local_menu { | ||
get { | ||
if(global == null) return base.show_local_menu; | ||
return global.show_local_menu || base.show_local_menu; | ||
} | ||
set { | ||
base.show_local_menu = value; | ||
} | ||
} | ||
public override bool show_menu_icons { | ||
get { | ||
if(global == null) return base.show_menu_icons; | ||
return global.show_menu_icons && base.show_menu_icons; | ||
} | ||
set { | ||
base.show_menu_icons = value; | ||
} | ||
} | ||
public override int changed_notify_timeout { | ||
get { | ||
if(global == null) return base.changed_notify_timeout; | ||
if(global.changed_notify_timeout < base.changed_notify_timeout) { | ||
return global.changed_notify_timeout; | ||
} | ||
return base.changed_notify_timeout; | ||
} | ||
set { | ||
base.changed_notify_timeout = value; | ||
} | ||
} | ||
|
||
public LocalSettings(Gdk.Window? window = null) { | ||
attach_to_window(window); | ||
this.show_local_menu = false; | ||
} | ||
public override void attach_to_window(Gdk.Window? window = null) { | ||
base.attach_to_window(window); | ||
if(window != null) | ||
global = Gnomenu.GlobalSettings.get(window.get_screen()); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters