[dia] [cleanup] Reduce special handling with (ddisp->menu_bar == NULL)
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] [cleanup] Reduce special handling with (ddisp->menu_bar == NULL)
- Date: Sun, 11 Jan 2015 20:14:16 +0000 (UTC)
commit 38f5db3be15093f03543628cf608a7deed66e8b7
Author: Hans Breuer <hans breuer org>
Date: Sun Dec 14 18:12:42 2014 +0100
[cleanup] Reduce special handling with (ddisp->menu_bar == NULL)
probably since GtkAction usage there is no need for different code paths anymore
app/display.c | 52 ++++++++++++++++------------------------------------
1 files changed, 16 insertions(+), 36 deletions(-)
---
diff --git a/app/display.c b/app/display.c
index c44cea6..157cad6 100644
--- a/app/display.c
+++ b/app/display.c
@@ -832,15 +832,10 @@ ddisplay_set_snap_to_grid(DDisplay *ddisp, gboolean snap)
GtkToggleAction *snap_to_grid;
ddisp->grid.snap = snap;
- if (ddisp->menu_bar == NULL) {
- snap_to_grid = GTK_TOGGLE_ACTION (menus_get_action ("ViewSnaptogrid"));
- if (is_integrated_ui ())
- integrated_ui_toolbar_grid_snap_synchronize_to_display (ddisp);
- } else {
- snap_to_grid = GTK_TOGGLE_ACTION (gtk_action_group_get_action (ddisp->actions, "ViewSnaptogrid"));
- }
- /* Currently, this can cause double emit, but that's a small problem.
- */
+ snap_to_grid = GTK_TOGGLE_ACTION (menus_get_action ("ViewSnaptogrid"));
+ if (is_integrated_ui ())
+ integrated_ui_toolbar_grid_snap_synchronize_to_display (ddisp);
+ /* Currently, this can cause double emit, but that's a small problem. */
gtk_toggle_action_set_active (snap_to_grid, ddisp->grid.snap);
ddisplay_update_statusbar(ddisp);
}
@@ -864,16 +859,10 @@ ddisplay_set_snap_to_objects(DDisplay *ddisp, gboolean magnetic)
GtkToggleAction *mainpoint_magnetism;
ddisp->mainpoint_magnetism = magnetic;
- if (ddisp->menu_bar == NULL) {
- mainpoint_magnetism = GTK_TOGGLE_ACTION (menus_get_action ("ViewSnaptoobjects"));
- if (is_integrated_ui ())
- integrated_ui_toolbar_object_snap_synchronize_to_display (ddisp);
- } else {
- mainpoint_magnetism = GTK_TOGGLE_ACTION (gtk_action_group_get_action (ddisp->actions,
"ViewSnaptoobjects"));
- }
-
- /* Currently, this can cause double emit, but that's a small problem.
- */
+ mainpoint_magnetism = GTK_TOGGLE_ACTION (menus_get_action ("ViewSnaptoobjects"));
+ if (is_integrated_ui ())
+ integrated_ui_toolbar_object_snap_synchronize_to_display (ddisp);
+ /* Currently, this can cause double emit, but that's a small problem. */
gtk_toggle_action_set_active (mainpoint_magnetism, ddisp->mainpoint_magnetism);
ddisplay_update_statusbar(ddisp);
}
@@ -1337,33 +1326,24 @@ display_update_menu_state(DDisplay *ddisp)
GtkToggleAction *show_cx_pts;
GtkToggleAction *antialiased;
- if (ddisp->menu_bar == NULL) {
- rulers = GTK_TOGGLE_ACTION (menus_get_action ("ViewShowrulers"));
- visible_grid = GTK_TOGGLE_ACTION (menus_get_action ("ViewShowgrid"));
- snap_to_grid = GTK_TOGGLE_ACTION (menus_get_action ("ViewSnaptogrid"));
- show_cx_pts = GTK_TOGGLE_ACTION (menus_get_action ("ViewShowconnectionpoints"));
- antialiased = GTK_TOGGLE_ACTION (menus_get_action ("ViewAntialiased"));
- } else {
- rulers = GTK_TOGGLE_ACTION (gtk_action_group_get_action (ddisp->actions, "ViewShowrulers"));
- visible_grid = GTK_TOGGLE_ACTION (gtk_action_group_get_action (ddisp->actions, "ViewShowgrid"));
- snap_to_grid = GTK_TOGGLE_ACTION (gtk_action_group_get_action (ddisp->actions, "ViewSnaptogrid"));
- show_cx_pts = GTK_TOGGLE_ACTION (gtk_action_group_get_action (ddisp->actions,
"ViewShowconnectionpoints"));
+ rulers = GTK_TOGGLE_ACTION (menus_get_action ("ViewShowrulers"));
+ visible_grid = GTK_TOGGLE_ACTION (menus_get_action ("ViewShowgrid"));
+ snap_to_grid = GTK_TOGGLE_ACTION (menus_get_action ("ViewSnaptogrid"));
+ show_cx_pts = GTK_TOGGLE_ACTION (menus_get_action ("ViewShowconnectionpoints"));
+ antialiased = GTK_TOGGLE_ACTION (menus_get_action ("ViewAntialiased"));
- antialiased = GTK_TOGGLE_ACTION (gtk_action_group_get_action (ddisp->actions, "ViewAntialiased"));
- }
gtk_action_set_sensitive (menus_get_action ("ViewAntialiased"),
g_type_from_name ("DiaCairoInteractiveRenderer") != 0 || g_type_from_name
("DiaLibartRenderer") != 0);
-
ddisplay_do_update_menu_sensitivity (ddisp);
gtk_toggle_action_set_active (rulers, display_get_rulers_showing(ddisp));
gtk_toggle_action_set_active (visible_grid,
- ddisp->grid.visible);
+ ddisp->grid.visible);
gtk_toggle_action_set_active (snap_to_grid,
- ddisp->grid.snap);
+ ddisp->grid.snap);
gtk_toggle_action_set_active (show_cx_pts,
- ddisp->show_cx_pts);
+ ddisp->show_cx_pts);
gtk_toggle_action_set_active (antialiased,
ddisp->aa_renderer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]