[dia] Remove app_is_embedded()
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] Remove app_is_embedded()
- Date: Sun, 29 Jul 2012 20:49:06 +0000 (UTC)
commit 30fa8fea61d232ad791c4f0b0fc856248d3dec7c
Author: Hans Breuer <hans breuer org>
Date: Fri Jul 27 23:07:02 2012 +0200
Remove app_is_embedded()
It was returning 0 for years.
app/app_procs.c | 5 ----
app/app_procs.h | 1 -
app/dia.def | 1 -
app/diagram.c | 8 +-----
app/display.c | 5 +--
app/interface.c | 59 ++++++++++++++++++++++++------------------------------
app/interface.h | 2 +-
7 files changed, 31 insertions(+), 50 deletions(-)
---
diff --git a/app/app_procs.c b/app/app_procs.c
index 32814b0..da2a134 100644
--- a/app/app_procs.c
+++ b/app/app_procs.c
@@ -1292,8 +1292,3 @@ print_credits(gboolean credits)
exit(0);
}
}
-
-int app_is_embedded(void)
-{
- return 0;
-}
diff --git a/app/app_procs.h b/app/app_procs.h
index bd30fd8..69fa827 100644
--- a/app/app_procs.h
+++ b/app/app_procs.h
@@ -26,7 +26,6 @@ void app_init(int argc, char **argv);
* Returns TRUE if the application exits.
*/
gboolean app_exit(void);
-int app_is_embedded(void);
void app_splash_init(const gchar* name);
void app_splash_done(void);
diff --git a/app/dia.def b/app/dia.def
index 4bbffa4..b94c1c1 100644
--- a/app/dia.def
+++ b/app/dia.def
@@ -40,7 +40,6 @@ EXPORTS
dia_open_diagrams
; just for the applications
- app_is_embedded
app_init
app_is_interactive
app_splash_done
diff --git a/app/diagram.c b/app/diagram.c
index f2d3027..a074799 100644
--- a/app/diagram.c
+++ b/app/diagram.c
@@ -657,12 +657,8 @@ diagram_remove_ddisplay(Diagram *dia, DDisplay *ddisp)
{
dia->displays = g_slist_remove(dia->displays, ddisp);
- if (g_slist_length(dia->displays) == 0) {
- if (!app_is_embedded()) {
- /* Don't delete embedded diagram when last view is closed */
- diagram_destroy(dia);
- }
- }
+ if (g_slist_length(dia->displays) == 0)
+ diagram_destroy(dia);
}
void
diff --git a/app/display.c b/app/display.c
index ce929a6..5a3e531 100644
--- a/app/display.c
+++ b/app/display.c
@@ -188,7 +188,7 @@ initialize_display_widgets(DDisplay *ddisp)
filename++;
}
create_display_shell(ddisp, prefs.new_view.width, prefs.new_view.height,
- filename, prefs.new_view.use_menu_bar, !app_is_embedded());
+ filename, prefs.new_view.use_menu_bar);
ddisplay_update_statusbar (ddisp);
@@ -196,8 +196,7 @@ initialize_display_widgets(DDisplay *ddisp)
ddisplay_update_scrollbars(ddisp);
ddisplay_add_update_all(ddisp);
- if (!app_is_embedded())
- ddisplay_set_cursor(ddisp, current_cursor);
+ ddisplay_set_cursor(ddisp, current_cursor);
if (!input_methods_done) {
im_menu_item = menus_get_action ("InputMethods");
diff --git a/app/interface.c b/app/interface.c
index 6cd9a75..f2220ba 100644
--- a/app/interface.c
+++ b/app/interface.c
@@ -572,12 +572,11 @@ use_integrated_ui_for_display_shell(DDisplay *ddisp, char *title)
* @param height Diagram Height
* @param title Window title
* @param use_mbar Flag to indicate whether to add a menubar to the window
- * @param top_level_window
*/
void
create_display_shell(DDisplay *ddisp,
int width, int height,
- char *title, int use_mbar, int top_level_window)
+ char *title, int use_mbar)
{
GtkWidget *table, *widget;
GtkWidget *navigation_button;
@@ -608,24 +607,21 @@ create_display_shell(DDisplay *ddisp,
ddisp->vsbdata = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, height, 1, (height-1)/4, height-1));
/* The toplevel shell */
- if (top_level_window) {
- 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);
- }
- } else {
- ddisp->shell = gtk_event_box_new ();
+ 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);
gtk_widget_set_events (ddisp->shell,
GDK_POINTER_MOTION_MASK |
@@ -738,8 +734,8 @@ create_display_shell(DDisplay *ddisp,
/* TODO rob use per window accel */
ddisp->accel_group = menus_get_display_accels ();
- if (top_level_window)
- gtk_window_add_accel_group(GTK_WINDOW(ddisp->shell), ddisp->accel_group);
+ 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);
@@ -866,18 +862,15 @@ toolbox_destroy (GtkWidget *widget, gpointer data)
static gboolean
toolbox_delete (GtkWidget *widget, GdkEvent *event, gpointer data)
{
- if (!app_is_embedded()) {
- gulong handlerid;
- /** Stop toolbox_destroy from being called */
- handlerid = g_signal_handler_find(widget, G_SIGNAL_MATCH_FUNC,
- 0, 0, NULL, toolbox_destroy, NULL);
- if (handlerid != 0)
- g_signal_handler_disconnect (GTK_OBJECT (widget), handlerid);
-
- /** If the app didn't exit, don't close the window */
- return (!app_exit());
- }
- return FALSE;
+ gulong handlerid;
+ /** Stop toolbox_destroy from being called */
+ handlerid = g_signal_handler_find(widget, G_SIGNAL_MATCH_FUNC,
+ 0, 0, NULL, toolbox_destroy, NULL);
+ if (handlerid != 0)
+ g_signal_handler_disconnect (GTK_OBJECT (widget), handlerid);
+
+ /** If the app didn't exit, don't close the window */
+ return (!app_exit());
}
static void
diff --git a/app/interface.h b/app/interface.h
index c95ba5f..0a33252 100644
--- a/app/interface.h
+++ b/app/interface.h
@@ -44,7 +44,7 @@ int is_integrated_ui (void);
void create_display_shell(DDisplay *ddisp,
int width, int height,
- char *title, int use_mbar, int top_level_window);
+ char *title, int use_mbar);
void create_toolbox (void);
void toolbox_show(void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]