[dia/zbrown/remove-non-integrated-ui] Remove large chunk of non-integrated ui



commit 53e29b35b78f1b22acc231d88ab8c97e207a6efc
Author: Zander Brown <zbrown gnome org>
Date:   Mon Jan 28 17:52:38 2019 +0000

    Remove large chunk of non-integrated ui

 .gitignore           |   4 +
 app/app_procs.c      | 192 ++++++++++++-----------------------
 app/disp_callbacks.c |  22 ++--
 app/display.c        |  27 +----
 app/interface.c      | 276 ++-------------------------------------------------
 app/interface.h      |   5 -
 app/layer_dialog.c   |  85 +---------------
 app/layer_dialog.h   |   1 -
 app/menus.c          |  30 +-----
 app/menus.h          |   2 -
 app/preferences.h    |   2 -
 11 files changed, 87 insertions(+), 559 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 8836c4fb..4840e090 100644
--- a/.gitignore
+++ b/.gitignore
@@ -42,3 +42,7 @@ doc/*/graphics/*.eps
 doc/*/.epsfigures
 doc/*/dia_html
 /build/win32/Thumbs.db
+.vscode/
+tests/sizeof
+tests/testsvg
+compile
diff --git a/app/app_procs.c b/app/app_procs.c
index dfd84e9c..bc9d38ed 100644
--- a/app/app_procs.c
+++ b/app/app_procs.c
@@ -617,7 +617,6 @@ app_init (int argc, char **argv)
 {
   static gboolean nosplash = FALSE;
   static gboolean nonew = FALSE;
-  static gboolean use_integrated_ui = TRUE;
   static gboolean credits = FALSE;
   static gboolean list_filters = FALSE;
   static gboolean version = FALSE;
@@ -650,8 +649,6 @@ app_init (int argc, char **argv)
      N_("Don't show the splash screen"), NULL },
     {"nonew", 'n', 0, G_OPTION_ARG_NONE, &nonew,
      N_("Don't create an empty diagram"), NULL },
-    {"classic", '\0', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &use_integrated_ui,
-     N_("Start classic user interface (no diagrams in tabs)"), NULL },
     {"log-to-stderr", 'l', 0, G_OPTION_ARG_NONE, &log_to_stderr,
      N_("Send error messages to stderr instead of showing dialogs."), NULL },
     {"input-directory", 'I', 0, G_OPTION_ARG_CALLBACK, _check_option_input_directory,
@@ -676,8 +673,8 @@ app_init (int argc, char **argv)
   options[1].arg_data = &export_file_format;
   options[3].arg_data = &size;
   options[4].arg_data = &show_layers;
-  g_assert (strcmp (options[14].long_name, G_OPTION_REMAINING) == 0);
-  options[14].arg_data = (void*)&filenames;
+  g_assert (strcmp (options[13].long_name, G_OPTION_REMAINING) == 0);
+  options[13].arg_data = (void*)&filenames;
 
   argv0 = (argc > 0) ? argv[0] : "(none)";
 
@@ -851,14 +848,7 @@ app_init (int argc, char **argv)
     active_tool = create_modify_tool();
 
     dia_log_message ("ui creation");
-    if (use_integrated_ui) {
-      create_integrated_ui();
-    } else {
-      create_toolbox();
-      /* for the integrated ui case it is integrated */
-      persistence_register_window_create("layer_window",
-                                        (NullaryFunc*)&layer_dialog_create);
-    }
+    create_integrated_ui();
     /*fill recent file menu */
     recent_file_history_init();
 
@@ -882,29 +872,14 @@ app_init (int argc, char **argv)
                                         input_directory, output_directory);
 
   if (dia_is_interactive && files == NULL && !nonew) {
-    if (use_integrated_ui) {
-      GList * list;
+    GList * list;
 
-      file_new_callback(NULL);  
-      list = dia_open_diagrams();
-      if (list) {
-        Diagram * diagram = list->data;
-        diagram_update_extents(diagram);
-        diagram->is_default = TRUE;
-      }
-    } else {
-      gchar *filename = g_filename_from_utf8(_("Diagram1.dia"), -1, NULL, NULL, NULL);
-      Diagram *diagram = new_diagram (filename);
-      g_free(filename);
-    
-      if (diagram != NULL) {
-        diagram_update_extents(diagram);
-        diagram->is_default = TRUE;
-        /* I think this is done in diagram_init() with a call to 
-         * layer_dialog_update_diagram_list() */
-        layer_dialog_set_diagram(diagram);
-        new_display(diagram); 
-      }
+    file_new_callback(NULL);  
+    list = dia_open_diagrams();
+    if (list) {
+      Diagram * diagram = list->data;
+      diagram_update_extents(diagram);
+      diagram->is_default = TRUE;
     }
   }
   g_slist_free(files);
@@ -934,112 +909,67 @@ app_exit(void)
   }
 
   if (diagram_modified_exists()) {
-    if (is_integrated_ui ())
-    {
-      GtkWidget                *dialog;
-      int                       result;
-      exit_dialog_item_array_t *items  = NULL;
-      GList *                   list; 
-      Diagram *                 diagram;
-      
-      dialog = exit_dialog_make (GTK_WINDOW (interface_get_toolbox_shell ()), 
-                                _("Exiting Dia"));
-
-      list = dia_open_diagrams();
-      while (list)
-      {
-        diagram = list->data;
+    GtkWidget                *dialog;
+    int                       result;
+    exit_dialog_item_array_t *items  = NULL;
+    GList *                   list; 
+    Diagram *                 diagram;
+    
+    dialog = exit_dialog_make (GTK_WINDOW (interface_get_toolbox_shell ()), 
+                              _("Exiting Dia"));
 
-        if (diagram_is_modified (diagram))
-        {
-          const gchar * name = diagram_get_name (diagram);
-          const gchar * path = diagram->filename;
-          exit_dialog_add_item (dialog, name, path, diagram);
-        }
+    list = dia_open_diagrams();
+    while (list) {
+      diagram = list->data;
 
-        list = g_list_next (list);
+      if (diagram_is_modified (diagram)) {
+        const gchar * name = diagram_get_name (diagram);
+        const gchar * path = diagram->filename;
+        exit_dialog_add_item (dialog, name, path, diagram);
       }
 
-      result = exit_dialog_run (dialog, &items);
-  
-      gtk_widget_destroy (dialog);
-
-      if (result == EXIT_DIALOG_EXIT_CANCEL)
-      {
-        return FALSE;
-      }
-      else if (result == EXIT_DIALOG_EXIT_SAVE_SELECTED)
-      {
-           DiaContext *ctx = dia_context_new(_("Save"));
-        int i;
-        for (i = 0 ; i < items->array_size ; i++) {
-         gchar *filename;
-
-         diagram  = items->array[i].data;
-         filename = g_filename_from_utf8 (diagram->filename, -1, NULL, NULL, NULL);
-         diagram_update_extents (diagram);
-         dia_context_set_filename (ctx, filename);
-         if (!diagram_save (diagram, filename, ctx)) {
-           exit_dialog_free_items (items);
-           dia_context_release (ctx);
-           return FALSE;
-         } else {
-           dia_context_reset (ctx);
-         }
-         g_free (filename);
-       }
-       dia_context_release (ctx);
-       exit_dialog_free_items (items);
-      } 
-      else if (result == EXIT_DIALOG_EXIT_NO_SAVE) 
-      {
-        list = dia_open_diagrams();
-        while (list) {
-          diagram = list->data;
-
-         /* slight hack: don't ask again */
-          diagram_set_modified (diagram, FALSE);
-         undo_clear(diagram->undo);
-          list = g_list_next (list);
-       }
-      }
+      list = g_list_next (list);
     }
-    else
-    {
-    GtkWidget *dialog;
-    GtkWidget *button;
-    dialog = gtk_message_dialog_new(
-              NULL, GTK_DIALOG_MODAL,
-               GTK_MESSAGE_QUESTION,
-               GTK_BUTTONS_NONE, /* no standard buttons */
-              _("Quitting without saving modified diagrams"));
-    gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog),
-                _("Modified diagrams exist. "
-                "Are you sure you want to quit Dia "
-                "without saving them?"));
-
-    gtk_window_set_title (GTK_WINDOW(dialog), _("Quit Dia"));
-  
-    button = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
-    gtk_dialog_add_action_widget (GTK_DIALOG(dialog), button, GTK_RESPONSE_CANCEL);
-#if GTK_CHECK_VERSION(2,18,0)
-    gtk_widget_set_can_default (GTK_WIDGET (button), TRUE);
-#else
-    GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
-#endif
-    gtk_dialog_set_default_response (GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL);
 
-    button = gtk_button_new_from_stock (GTK_STOCK_QUIT);
-    gtk_dialog_add_action_widget (GTK_DIALOG(dialog), button, GTK_RESPONSE_OK);
+    result = exit_dialog_run (dialog, &items);
 
-    gtk_widget_show_all (dialog);
+    gtk_widget_destroy (dialog);
 
-    if (gtk_dialog_run(GTK_DIALOG(dialog)) != GTK_RESPONSE_OK) {
-      gtk_widget_destroy(dialog);
+    if (result == EXIT_DIALOG_EXIT_CANCEL) {
       return FALSE;
+    } else if (result == EXIT_DIALOG_EXIT_SAVE_SELECTED) {
+      DiaContext *ctx = dia_context_new(_("Save"));
+      int i;
+      for (i = 0 ; i < items->array_size ; i++) {
+        gchar *filename;
+
+        diagram  = items->array[i].data;
+        filename = g_filename_from_utf8 (diagram->filename, -1, NULL, NULL, NULL);
+        diagram_update_extents (diagram);
+        dia_context_set_filename (ctx, filename);
+        if (!diagram_save (diagram, filename, ctx)) {
+          exit_dialog_free_items (items);
+          dia_context_release (ctx);
+          return FALSE;
+        } else {
+          dia_context_reset (ctx);
+        }
+        g_free (filename);
+      }
+      dia_context_release (ctx);
+      exit_dialog_free_items (items);
+    } else if (result == EXIT_DIALOG_EXIT_NO_SAVE)  {
+      list = dia_open_diagrams();
+      while (list) {
+        diagram = list->data;
+        
+        /* slight hack: don't ask again */
+        diagram_set_modified (diagram, FALSE);
+        undo_clear(diagram->undo);
+        list = g_list_next (list);
+      }
     }
-    gtk_widget_destroy(dialog);
-    }
+    
   }
   prefs_save();
 
diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c
index 82555660..744ecadc 100644
--- a/app/disp_callbacks.c
+++ b/app/disp_callbacks.c
@@ -819,29 +819,21 @@ ddisplay_canvas_events (GtkWidget *canvas,
              hold_data.tag = g_timeout_add(1000, hold_timeout_handler, NULL);
               break;
             case 2:
-              if (ddisp->menu_bar == NULL && !is_integrated_ui()) {
-                popup_object_menu(ddisp, event);
+              if (!transient_tool) {
+                gtk_widget_grab_focus(canvas);
+                transient_tool = create_scroll_tool();
+                (*transient_tool->button_press_func) (transient_tool, bevent, ddisp);
               }
-             else if (!transient_tool) {
-               gtk_widget_grab_focus(canvas);
-               transient_tool = create_scroll_tool();
-               (*transient_tool->button_press_func) (transient_tool, bevent, ddisp);
-             }
               break;
 
             case 3:
               if (transient_tool)
                 break;
               if (ddisp->menu_bar == NULL) {
-                if (bevent->state & GDK_CONTROL_MASK || is_integrated_ui ()) {
-                      /* for two button mouse users ... */
-                  popup_object_menu(ddisp, event);
-                  break;
-                }
-                ddisplay_popup_menu(ddisp, bevent);
+                /* for two button mouse users ... */
+                popup_object_menu(ddisp, event);
                 break;
-              }
-              else {
+              } else {
                 popup_object_menu(ddisp, event);
                 break;
               }
diff --git a/app/display.c b/app/display.c
index 076d0468..6238d377 100644
--- a/app/display.c
+++ b/app/display.c
@@ -66,22 +66,9 @@ update_zoom_status(DDisplay *ddisp)
 {
   gchar* zoom_text;
 
-  if (is_integrated_ui ())
-  {
-    zoom_text = g_strdup_printf("%.0f%%",
-          ddisp->zoom_factor * 100.0 / DDISPLAY_NORMAL_ZOOM);
+  zoom_text = g_strdup_printf ("%.0f%%", ddisp->zoom_factor * 100.0 / DDISPLAY_NORMAL_ZOOM);
 
-    integrated_ui_toolbar_set_zoom_text (ddisp->common_toolbar, zoom_text);  
-  }
-  else
-  {
-    GtkWidget *zoomcombo;
-    zoom_text = g_strdup_printf("%.1f%%",
-            ddisp->zoom_factor * 100.0 / DDISPLAY_NORMAL_ZOOM);
-    zoomcombo = ddisp->zoom_status;
-    gtk_entry_set_text(GTK_ENTRY (g_object_get_data (G_OBJECT(zoomcombo), "user_data")),
-                      zoom_text);
-  }
+  integrated_ui_toolbar_set_zoom_text (ddisp->common_toolbar, zoom_text);
 
   g_free(zoom_text); /* Copied by gtk_entry_set_text */
 }
@@ -833,8 +820,7 @@ ddisplay_set_snap_to_grid(DDisplay *ddisp, gboolean snap)
   ddisp->grid.snap = snap;
 
   snap_to_grid = GTK_TOGGLE_ACTION (menus_get_action ("ViewSnaptogrid"));
-  if (is_integrated_ui ())
-    integrated_ui_toolbar_grid_snap_synchronize_to_display (ddisp);
+  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);
@@ -860,8 +846,7 @@ ddisplay_set_snap_to_objects(DDisplay *ddisp, gboolean magnetic)
   ddisp->mainpoint_magnetism = magnetic;
 
   mainpoint_magnetism = GTK_TOGGLE_ACTION (menus_get_action ("ViewSnaptoobjects"));
-  if (is_integrated_ui ())
-    integrated_ui_toolbar_object_snap_synchronize_to_display (ddisp);
+  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);
@@ -1603,10 +1588,6 @@ display_set_active(DDisplay *ddisp)
 
         gtk_window_present (GTK_WINDOW(ddisp->shell));
       }
-    } else {
-      /* TODO: Prevent gtk_window_set_transient_for() in Integrated UI case */
-      gtk_window_set_transient_for(GTK_WINDOW(interface_get_toolbox_shell()),
-                                   NULL);
     }
   }
 }
diff --git a/app/interface.c b/app/interface.c
index 4bf12676..c800302c 100644
--- a/app/interface.c
+++ b/app/interface.c
@@ -127,17 +127,6 @@ static struct
     GtkWidget    * layer_view;
 } ui;
 
-/** 
- * Used to determine if the current user interface is the integrated interface or 
- * the distributed interface.  This cannot presently be determined by the preferences
- * setting because changing that setting at run time does not change the interface.
- * @return Non-zero if the integrated interface is present, else zero.
- */
-int is_integrated_ui (void)
-{
-  return ui.main_window == NULL? 0 : 1;
-}
-
 static void
 grid_toggle_snap(GtkWidget *widget, gpointer data)
 {
@@ -376,11 +365,7 @@ canvas_configure_event (GtkWidget         *widget,
     new_size = TRUE;
   }
 
-  /* If the UI is not integrated, resizing should set the resized
-   * window as active.  With integrated UI, there is only one window.
-   */
-  if (is_integrated_ui () == 0)
-    display_set_active(ddisp);
+  display_set_active (ddisp);
 
   /* continue propagation with FALSE */
   return new_size;
@@ -651,203 +636,14 @@ use_integrated_ui_for_display_shell(DDisplay *ddisp, char *title)
  * @param use_mbar Flag to indicate whether to add a menubar to the window
  */
 void
-create_display_shell(DDisplay *ddisp,
-                    int width, int height,
-                    char *title, int use_mbar)
+create_display_shell (DDisplay *ddisp,
+                      int       width,
+                      int       height,
+                      char     *title,
+                      int       use_mbar)
 {
-  GtkWidget *table, *widget;
-  GtkWidget *status_hbox;
-  GtkWidget *root_vbox = NULL;
-  GtkWidget *zoom_hbox, *zoom_label;
-  int s_width, s_height;
-
-  if (app_is_interactive() && is_integrated_ui())
-  {
-    use_integrated_ui_for_display_shell(ddisp, title);
-    return;
-  }
- 
-  ddisp->is_standalone_window = TRUE;
-  ddisp->container            = NULL;
-
-  s_width = gdk_screen_width ();
-  s_height = gdk_screen_height ();
-  if (width > s_width)
-    width = s_width;
-  if (height > s_height)
-    height = s_height;
-
-  /*  The toplevel shell */
-  ddisp->shell = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-  gtk_window_set_title (GTK_WINDOW (ddisp->shell), title);
-  gtk_window_set_role (GTK_WINDOW (ddisp->shell), "diagram_window");
-  gtk_window_set_icon_name (GTK_WINDOW (ddisp->shell), "dia");
-  gtk_window_set_default_size(GTK_WINDOW (ddisp->shell), width, height);
-  /* set_icon_name needs registered theme icons, not always available: provide fallback */
-  if (!gtk_window_get_icon (GTK_WINDOW (ddisp->shell))) {
-    static GdkPixbuf *pixbuf = NULL;
-
-    if (!pixbuf)
-      pixbuf = gdk_pixbuf_new_from_inline(-1, dia_diagram_icon, FALSE, NULL);
-    if (pixbuf)
-      gtk_window_set_icon (GTK_WINDOW (ddisp->shell), pixbuf);
-  }
-
-  g_object_set_data (G_OBJECT (ddisp->shell), "user_data", (gpointer) ddisp);
-
-  _ddisplay_setup_events (ddisp, ddisp->shell);
-  /* following two not shared with integrated UI */
-  g_signal_connect (G_OBJECT (ddisp->shell), "delete_event",
-                   G_CALLBACK (ddisplay_delete), ddisp);
-  g_signal_connect (G_OBJECT (ddisp->shell), "destroy",
-                   G_CALLBACK (ddisplay_destroy), ddisp);
-
-  /*  the table containing all widgets  */
-  table = gtk_table_new (4, 3, FALSE);
-  gtk_table_set_col_spacing (GTK_TABLE (table), 0, 1);
-  gtk_table_set_col_spacing (GTK_TABLE (table), 1, 2);
-  gtk_table_set_row_spacing (GTK_TABLE (table), 0, 1);
-  gtk_table_set_row_spacing (GTK_TABLE (table), 1, 2);
-  gtk_container_set_border_width (GTK_CONTAINER (table), 2);
-  if (use_mbar) 
-  {
-      root_vbox = gtk_vbox_new (FALSE, 1);
-      gtk_container_add (GTK_CONTAINER (ddisp->shell), root_vbox);
-      gtk_box_pack_end (GTK_BOX (root_vbox), table, TRUE, TRUE, 0);
-  }
-  else
-  {
-      gtk_container_add (GTK_CONTAINER (ddisp->shell), table);
-  }
-  
-
-  /*  scrollbars, rulers, canvas, menu popup button  */
-  if (!use_mbar) {
-      ddisp->origin = gtk_button_new();
-#if GTK_CHECK_VERSION(2,18,0)
-      gtk_widget_set_can_focus (ddisp->origin, FALSE);
-#else
-      GTK_WIDGET_UNSET_FLAGS(ddisp->origin, GTK_CAN_FOCUS);
-#endif
-      widget = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
-      gtk_container_add(GTK_CONTAINER(ddisp->origin), widget);
-      gtk_widget_set_tooltip_text(widget, _("Diagram menu."));
-      gtk_widget_show(widget);
-      g_signal_connect(G_OBJECT(ddisp->origin), "button_press_event",
-                    G_CALLBACK(origin_button_press), ddisp);
-  }
-  else {
-      ddisp->origin = gtk_frame_new (NULL);
-      gtk_frame_set_shadow_type (GTK_FRAME (ddisp->origin), GTK_SHADOW_OUT);
-  }
-  
-  _ddisplay_setup_rulers (ddisp, ddisp->shell, table);
-  _ddisplay_setup_scrollbars (ddisp, table, width, height);
-  _ddisplay_setup_navigation (ddisp, table, FALSE);
-
-  ddisp->canvas = create_canvas (ddisp);
-
-  /*  pack all remaining widgets  */
-  gtk_table_attach (GTK_TABLE (table), ddisp->origin, 0, 1, 0, 1,
-                    GTK_FILL, GTK_FILL, 0, 0);
-  gtk_table_attach (GTK_TABLE (table), ddisp->canvas, 1, 2, 1, 2,
-                    GTK_EXPAND | GTK_SHRINK | GTK_FILL,
-                    GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
-
-  /* TODO rob use per window accel */
-  ddisp->accel_group = menus_get_display_accels ();
-  gtk_window_add_accel_group(GTK_WINDOW(ddisp->shell), ddisp->accel_group);
-
-  if (use_mbar) {
-    ddisp->menu_bar = menus_create_display_menubar (&ddisp->ui_manager, &ddisp->actions);
-    g_assert (ddisp->menu_bar);
-    gtk_box_pack_start (GTK_BOX (root_vbox), ddisp->menu_bar, FALSE, TRUE, 0);
-  }
-
-  /* the statusbars */
-  status_hbox = gtk_hbox_new (FALSE, 2);
-
-  /* Zoom status pseudo-optionmenu */
-  ddisp->zoom_status = create_zoom_widget(ddisp);
-  zoom_hbox = gtk_hbox_new(FALSE, 0);
-  zoom_label = gtk_label_new(_("Zoom"));
-  gtk_box_pack_start (GTK_BOX(zoom_hbox), zoom_label,
-                     FALSE, FALSE, 0);
-  gtk_box_pack_start (GTK_BOX(zoom_hbox), ddisp->zoom_status,
-                     FALSE, FALSE, 0);
-
-  gtk_box_pack_start (GTK_BOX (status_hbox), zoom_hbox, FALSE, FALSE, 0);
-
-  /* Grid on/off button */
-  ddisp->grid_status = dia_toggle_button_new_with_icons(dia_on_grid_icon,
-                                                       dia_off_grid_icon);
-  
-  g_signal_connect(G_OBJECT(ddisp->grid_status), "toggled",
-                  G_CALLBACK (grid_toggle_snap), ddisp);
-  gtk_widget_set_tooltip_text(ddisp->grid_status,
-                      _("Toggles snap-to-grid for this window."));
-  gtk_box_pack_start (GTK_BOX (status_hbox), ddisp->grid_status,
-                     FALSE, FALSE, 0);
-
-
-  ddisp->mainpoint_status = dia_toggle_button_new_with_icons(dia_mainpoints_on_icon,
-                                                       dia_mainpoints_off_icon);
-  
-  g_signal_connect(G_OBJECT(ddisp->mainpoint_status), "toggled",
-                  G_CALLBACK (interface_toggle_mainpoint_magnetism), ddisp);
-  gtk_widget_set_tooltip_text(ddisp->mainpoint_status,
-                      _("Toggles object snapping for this window."));
-  gtk_box_pack_start (GTK_BOX (status_hbox), ddisp->mainpoint_status,
-                     FALSE, FALSE, 0);
-
-
-  /* Statusbar */
-  ddisp->modified_status = gtk_statusbar_new ();
-
-  gtk_box_pack_start (GTK_BOX (status_hbox), ddisp->modified_status,
-                     TRUE, TRUE, 0);
-
-  gtk_table_attach (GTK_TABLE (table), status_hbox, 0, 3, 3, 4,
-                    GTK_FILL, GTK_FILL, 0, 0);
-
-  display_rulers_show (ddisp);
-  gtk_widget_show (ddisp->zoom_status);
-  gtk_widget_show (zoom_hbox);
-  gtk_widget_show (zoom_label);
-  gtk_widget_show (ddisp->grid_status);
-  gtk_widget_show (ddisp->mainpoint_status);
-  gtk_widget_show (ddisp->modified_status);
-  gtk_widget_show (status_hbox);
-  gtk_widget_show (table);
-  if (use_mbar) 
-  {
-      gtk_widget_show (ddisp->menu_bar);
-      gtk_widget_show (root_vbox);
-  }
-  gtk_widget_show (ddisp->shell);
-
-  /* before showing up, checking canvas's REAL size */
-  if (use_mbar && ddisp->hrule->allocation.width > width) 
-  {
-    /* The menubar is not shrinkable, so the shell will have at least
-     * the menubar's width. If the diagram's requested width is smaller,
-     * the canvas will be enlarged to fit the place. In this case, we
-     * need to adjust the horizontal scrollbar according to the size
-     * that will be allocated, which the same as the hrule got.
-     */
-
-    width = ddisp->hrule->allocation.width;
-
-    gtk_adjustment_set_upper (ddisp->hsbdata, width);
-    gtk_adjustment_set_page_increment (ddisp->hsbdata, (width - 1) / 4);
-    gtk_adjustment_set_page_size (ddisp->hsbdata, width - 1);
-
-    gtk_adjustment_changed (GTK_ADJUSTMENT(ddisp->hsbdata));
-  }
-  gtk_widget_show (ddisp->canvas);
-
-  /*  set the focus to the canvas area  */
-  gtk_widget_grab_focus (ddisp->canvas);
+  /* TODO: Merge function */
+  use_integrated_ui_for_display_shell (ddisp, title);
 }
 
 /**
@@ -1074,57 +870,6 @@ create_integrated_ui (void)
   toolbox_shell = window;
 }
 
-/**
- * Create toolbox component for distributed user interface 
- */
-void
-create_toolbox ()
-{
-  GtkWidget *window;
-  GtkWidget *main_vbox;
-  GtkWidget *wrapbox;
-  GtkWidget *menubar;
-  GtkAccelGroup *accel_group;
-
-  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-  g_object_ref(window);
-  gtk_window_set_title (GTK_WINDOW (window), "Dia v" VERSION);
-  gtk_window_set_role (GTK_WINDOW (window), "toolbox_window");
-  gtk_window_set_default_size(GTK_WINDOW(window), 146, 349);
-
-  app_set_icon (GTK_WINDOW (window));
-
-  g_signal_connect (G_OBJECT (window), "delete_event",
-                   G_CALLBACK (toolbox_delete), window);
-  g_signal_connect (G_OBJECT (window), "destroy",
-                   G_CALLBACK (toolbox_destroy), window);
-
-  main_vbox = gtk_vbox_new (FALSE, 1);
-  gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 1);
-  gtk_container_add (GTK_CONTAINER (window), main_vbox);
-
-  wrapbox = toolbox_create();
-  gtk_box_pack_end (GTK_BOX (main_vbox), wrapbox, TRUE, TRUE, 0);
-  g_signal_connect (G_OBJECT (wrapbox), "drag_data_received",
-                   G_CALLBACK (dia_dnd_file_drag_data_received),
-                    NULL); /* userdata == NULL here intentionally */
-  gtk_widget_show (main_vbox);
-
-  /* menus -- initialised afterwards, because initing the display menus
-   * uses the tool buttons*/
-  menus_get_toolbox_menubar(&menubar, &accel_group);
-  gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
-  gtk_widget_show (menubar);
-#  ifdef HAVE_MAC_INTEGRATION
-  _create_mac_integration (menubar);
-#  else
-  gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, TRUE, 0);
-#  endif
-  persistence_register_window(GTK_WINDOW(window));
-
-  toolbox_shell = window;
-}
-
 void
 toolbox_show(void)
 {
@@ -1140,10 +885,7 @@ toolbox_hide(void)
 GtkWidget *
 interface_get_toolbox_shell(void)
 {
-  if (is_integrated_ui ())
-    return GTK_WIDGET(ui.main_window);
-
-  return toolbox_shell;
+  return GTK_WIDGET(ui.main_window);
 }
 
 /* Indicate if the integrated UI toolbar is showing.
diff --git a/app/interface.h b/app/interface.h
index 9e9b9c0a..481c41d2 100644
--- a/app/interface.h
+++ b/app/interface.h
@@ -36,20 +36,15 @@ void     integrated_ui_statusbar_show (gboolean show);
 gboolean integrated_ui_layer_view_is_showing (void);
 void     integrated_ui_layer_view_show (gboolean show);
 
-int is_integrated_ui (void);
-
 void create_display_shell(DDisplay *ddisp,
                          int width, int height,
                          char *title, int use_mbar);
 
-void create_toolbox (void);
 void toolbox_show(void);
 void toolbox_hide(void);
 
 GtkWidget *interface_get_toolbox_shell(void);
 
-void create_integrated_ui (void);
-
 void create_sheets(GtkWidget *parent);
 extern GtkWidget *modify_tool_button;
 
diff --git a/app/layer_dialog.c b/app/layer_dialog.c
index 70e1384a..3f6eed55 100644
--- a/app/layer_dialog.c
+++ b/app/layer_dialog.c
@@ -674,26 +674,9 @@ layer_dialog_lower_callback(GtkWidget *widget, gpointer gdata)
   }
 }
 
-
-static void
-layer_dialog_select_diagram_callback(GtkWidget *widget, gpointer gdata)
-{
-  Diagram *dia = (Diagram *) gdata;
-
-  layer_dialog_set_diagram(dia);
-}
-     
 void
 layer_dialog_update_diagram_list(void)
 {
-  GtkWidget *new_menu;
-  GtkWidget *menu_item;
-  GList *dia_list;
-  Diagram *dia;
-  char *filename;
-  int i;
-  int current_nr;
-
   if (layer_dialog == NULL || layer_dialog->dialog == NULL) {
     if (!dia_open_diagrams())
       return; /* shortcut; maybe session end w/o this dialog */
@@ -701,78 +684,12 @@ layer_dialog_update_diagram_list(void)
       layer_dialog_create();
   }
   g_assert(layer_dialog != NULL); /* must be valid now */
-  /* oh this options: here integrated UI ;( */
-  if (!layer_dialog->diagram_omenu)
-    return;
-        
-  new_menu = gtk_menu_new();
-
-  current_nr = -1;
-  
-  i = 0;
-  dia_list = dia_open_diagrams();
-  while (dia_list != NULL) {
-    dia = (Diagram *) dia_list->data;
-
-    if (dia == layer_dialog->diagram) {
-      current_nr = i;
-    }
-    
-    filename = strrchr(dia->filename, G_DIR_SEPARATOR);
-    if (filename==NULL) {
-      filename = dia->filename;
-    } else {
-      filename++;
-    }
-
-    menu_item = gtk_menu_item_new_with_label(filename);
-
-    g_signal_connect (G_OBJECT (menu_item), "activate",
-                     G_CALLBACK (layer_dialog_select_diagram_callback), dia);
-
-    gtk_menu_append( GTK_MENU(new_menu), menu_item);
-    gtk_widget_show (menu_item);
-
-    dia_list = g_list_next(dia_list);
-    i++;
-  }
-
-  if (dia_open_diagrams()==NULL) {
-    menu_item = gtk_menu_item_new_with_label (_("none"));
-    g_signal_connect (G_OBJECT (menu_item), "activate",
-                     G_CALLBACK (layer_dialog_select_diagram_callback), NULL);
-    gtk_menu_append( GTK_MENU(new_menu), menu_item);
-    gtk_widget_show (menu_item);
-  }
-  
-  gtk_option_menu_remove_menu(GTK_OPTION_MENU(layer_dialog->diagram_omenu));
-
-  gtk_option_menu_set_menu(GTK_OPTION_MENU(layer_dialog->diagram_omenu),
-                          new_menu);
-
-  gtk_option_menu_set_history(GTK_OPTION_MENU(layer_dialog->diagram_omenu),
-                             current_nr);
-  gtk_menu_set_active(GTK_MENU(new_menu), current_nr);
-
-  if (current_nr == -1) {
-    dia = NULL;
-    if (dia_open_diagrams()!=NULL) {
-      dia = (Diagram *) dia_open_diagrams()->data;
-    }
-    layer_dialog_set_diagram(dia);
-  }
 }
 
 void
 layer_dialog_show()
 {
-  if (is_integrated_ui () == FALSE)
-  {   
-  if (layer_dialog == NULL || layer_dialog->dialog == NULL)
-    layer_dialog_create();
-  g_assert(layer_dialog != NULL); /* must be valid now */
-  gtk_window_present(GTK_WINDOW(layer_dialog->dialog));
-  }
+  /* TODO: Remove */
 }
 
 /*
diff --git a/app/layer_dialog.h b/app/layer_dialog.h
index 4faba5b7..8ebf2416 100644
--- a/app/layer_dialog.h
+++ b/app/layer_dialog.h
@@ -22,7 +22,6 @@
 #include "diagram.h"
 
 
-void layer_dialog_create(void);
 void layer_dialog_update_diagram_list(void);
 void layer_dialog_show(void);
 void layer_dialog_set_diagram(Diagram *dia);
diff --git a/app/menus.c b/app/menus.c
index b39bb73d..1236ada9 100644
--- a/app/menus.c
+++ b/app/menus.c
@@ -1078,19 +1078,6 @@ menus_get_integrated_ui_menubar (GtkWidget     **menubar,
     *accel_group = gtk_ui_manager_get_accel_group (_ui_manager);
 }
 
-void
-menus_get_toolbox_menubar (GtkWidget     **menubar,
-                          GtkAccelGroup **accel_group)
-{
-  if (initialise)
-    menus_init();
-
-  if (menubar)
-    *menubar = gtk_ui_manager_get_widget (_ui_manager, TOOLBOX_MENU);
-  if (accel_group)
-    *accel_group = gtk_ui_manager_get_accel_group (_ui_manager);
-}
-
 GtkWidget * 
 menus_get_display_popup (void)
 {
@@ -1100,18 +1087,6 @@ menus_get_display_popup (void)
   return display_menubar;
 }
 
-GtkAccelGroup * 
-menus_get_display_accels (void)
-{
-  /* for integrated-ui the accels are delivered by menus_get_integrated_ui_menubar() */
-  g_return_val_if_fail (is_integrated_ui () == FALSE, NULL);
-
-  if (initialise)
-    menus_init();
-
-  return display_accels;
-}
-
 GtkWidget *
 menus_create_display_menubar (GtkUIManager   **ui_manager, 
                              GtkActionGroup **actions)
@@ -1205,10 +1180,7 @@ menus_set_recent (GtkActionGroup *actions)
   guint id;
   const char   *recent_path;
 
-  if (is_integrated_ui ())
-    recent_path = INTEGRATED_MENU "/File/FileRecentEnd";
-  else
-    recent_path = TOOLBOX_MENU "/File/FileRecentEnd";
+  recent_path = INTEGRATED_MENU "/File/FileRecentEnd";
 
   if (recent_actions) {
     menus_clear_recent ();
diff --git a/app/menus.h b/app/menus.h
index d300bc6b..6d9b2f39 100644
--- a/app/menus.h
+++ b/app/menus.h
@@ -41,9 +41,7 @@ integrated_ui_toolbar_object_snap_synchronize_to_display (gpointer ddisp);
 /* TODO: rename: menus_get_integrated_ui_menubar() */
 void            menus_get_integrated_ui_menubar  (GtkWidget **menubar, GtkWidget **toolbar, 
                                                   GtkAccelGroup **accel);
-void            menus_get_toolbox_menubar        (GtkWidget **menubar, GtkAccelGroup **accel);
 GtkWidget     * menus_get_display_popup          (void);
-GtkAccelGroup * menus_get_display_accels         (void);
 GtkWidget *     menus_create_display_menubar     (GtkUIManager **ui_manager, GtkActionGroup **actions);
 
 GtkActionGroup *menus_get_tool_actions (void);
diff --git a/app/preferences.h b/app/preferences.h
index 8665f08b..fd190f66 100644
--- a/app/preferences.h
+++ b/app/preferences.h
@@ -67,8 +67,6 @@ struct DiaPreferences {
   int fixed_icon_size;
 
   int toolbox_on_top;
-
-  int use_integrated_ui;
   
   /* a dedicated filter name or NULL */
   struct {


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