Commit 45725591 authored by Paolo Borelli's avatar Paolo Borelli

cleanup

parent 272259e8
2006-08-11 Paolo Borelli <pborelli@katamail.com>
* gedit-prefs-manager-app.[ch]:
* gedit-window.c
* gedit-app.c:
small cleanup in setting/getting the window size.
2006-08-11 Paolo Borelli <pborelli@katamail.com>
* gedit/gedit-document-saver.c: preserve xattrs, patch by James
......
......@@ -434,14 +434,10 @@ gedit_prefs_manager_app_shutdown
gedit_prefs_manager_get_window_state
gedit_prefs_manager_set_window_state
gedit_prefs_manager_window_state_can_set
gedit_prefs_manager_get_window_height
gedit_prefs_manager_get_default_window_height
gedit_prefs_manager_set_window_height
gedit_prefs_manager_window_height_can_set
gedit_prefs_manager_get_window_width
gedit_prefs_manager_get_default_window_width
gedit_prefs_manager_set_window_width
gedit_prefs_manager_window_width_can_set
gedit_prefs_manager_get_window_size
gedit_prefs_manager_get_default_window_size
gedit_prefs_manager_set_window_size
gedit_prefs_manager_window_size_can_set
gedit_prefs_manager_get_side_panel_size
gedit_prefs_manager_get_default_side_panel_size
gedit_prefs_manager_set_side_panel_size
......
......@@ -281,23 +281,20 @@ gedit_app_create_window_real (GeditApp *app,
if (set_geometry)
{
GdkWindowState state;
gint w, h;
state = gedit_prefs_manager_get_window_state ();
if ((state & GDK_WINDOW_STATE_MAXIMIZED) != 0)
{
gtk_window_set_default_size (GTK_WINDOW (window),
gedit_prefs_manager_get_default_window_width (),
gedit_prefs_manager_get_default_window_height ());
gedit_prefs_manager_get_default_window_size (&w, &h);
gtk_window_set_default_size (GTK_WINDOW (window), w, h);
gtk_window_maximize (GTK_WINDOW (window));
}
else
{
gtk_window_set_default_size (GTK_WINDOW (window),
gedit_prefs_manager_get_window_width (),
gedit_prefs_manager_get_window_height ());
gedit_prefs_manager_get_window_size (&w, &h);
gtk_window_set_default_size (GTK_WINDOW (window), w, h);
gtk_window_unmaximize (GTK_WINDOW (window));
}
......
......@@ -266,64 +266,45 @@ gedit_prefs_manager_window_state_can_set (void)
return TRUE;
}
/* Window height */
gint
gedit_prefs_manager_get_window_height (void)
/* Window size */
void
gedit_prefs_manager_get_window_size (gint *width, gint *height)
{
g_return_if_fail (width != NULL && height != NULL);
if (window_width == -1)
window_width = gnome_config_get_int (GPM_WINDOW_WIDTH "=" GPM_DEFAULT_WINDOW_WIDTH_STR);
if (window_height == -1)
window_height = gnome_config_get_int (GPM_WINDOW_HEIGHT "=" GPM_DEFAULT_WINDOW_HEIGHT_STR);
return window_height;
}
gint
gedit_prefs_manager_get_default_window_height (void)
{
return GPM_DEFAULT_WINDOW_HEIGHT;
*width = window_width;
*height = window_height;
}
void
gedit_prefs_manager_set_window_height (gint wh)
gedit_prefs_manager_get_default_window_size (gint *width, gint *height)
{
g_return_if_fail (wh > -1);
g_return_if_fail (width != NULL && height != NULL);
window_height = wh;
gnome_config_set_int (GPM_WINDOW_HEIGHT, wh);
*width = GPM_DEFAULT_WINDOW_WIDTH;
*height = GPM_DEFAULT_WINDOW_HEIGHT;;
}
gboolean
gedit_prefs_manager_window_height_can_set (void)
{
return TRUE;
}
/* Window width */
gint
gedit_prefs_manager_get_window_width (void)
void
gedit_prefs_manager_set_window_size (gint width, gint height)
{
if (window_width == -1)
window_width = gnome_config_get_int (GPM_WINDOW_WIDTH "=" GPM_DEFAULT_WINDOW_WIDTH_STR);
g_return_if_fail (width > -1 && height > -1);
return window_width;
}
window_width = width;
window_height = height;
gint
gedit_prefs_manager_get_default_window_width (void)
{
return GPM_DEFAULT_WINDOW_WIDTH;
}
void
gedit_prefs_manager_set_window_width (gint ww)
{
g_return_if_fail (ww > -1);
window_width = ww;
gnome_config_set_int (GPM_WINDOW_WIDTH, ww);
gnome_config_set_int (GPM_WINDOW_WIDTH, width);
gnome_config_set_int (GPM_WINDOW_HEIGHT, height);
}
gboolean
gedit_prefs_manager_window_width_can_set (void)
gedit_prefs_manager_window_size_can_set (void)
{
return TRUE;
}
......
......@@ -48,17 +48,14 @@ gint gedit_prefs_manager_get_window_state (void);
void gedit_prefs_manager_set_window_state (gint ws);
gboolean gedit_prefs_manager_window_state_can_set (void);
/* Window height */
gint gedit_prefs_manager_get_window_height (void);
gint gedit_prefs_manager_get_default_window_height (void);
void gedit_prefs_manager_set_window_height (gint wh);
gboolean gedit_prefs_manager_window_height_can_set (void);
/* Window width */
gint gedit_prefs_manager_get_window_width (void);
gint gedit_prefs_manager_get_default_window_width (void);
void gedit_prefs_manager_set_window_width (gint ww);
gboolean gedit_prefs_manager_window_width_can_set (void);
/* Window size */
void gedit_prefs_manager_get_window_size (gint *width,
gint *height);
void gedit_prefs_manager_get_default_window_size (gint *width,
gint *height);
void gedit_prefs_manager_set_window_size (gint width,
gint height);
gboolean gedit_prefs_manager_window_size_can_set (void);
/* Side panel size */
gint gedit_prefs_manager_get_side_panel_size (void);
......
......@@ -144,11 +144,9 @@ gedit_window_destroy (GtkObject *object)
window = GEDIT_WINDOW (object);
if (gedit_prefs_manager_window_height_can_set ())
gedit_prefs_manager_set_window_height (window->priv->height);
if (gedit_prefs_manager_window_width_can_set ())
gedit_prefs_manager_set_window_width (window->priv->width);
if (gedit_prefs_manager_window_size_can_set ())
gedit_prefs_manager_set_window_size (window->priv->width,
window->priv->height);
if (gedit_prefs_manager_window_state_can_set ())
gedit_prefs_manager_set_window_state (window->priv->window_state);
......@@ -1589,10 +1587,10 @@ clone_window (GeditWindow *origin)
if ((origin->priv->window_state & GDK_WINDOW_STATE_MAXIMIZED) != 0)
{
gtk_window_set_default_size (window,
gedit_prefs_manager_get_default_window_width (),
gedit_prefs_manager_get_default_window_height ());
gint w, h;
gedit_prefs_manager_get_default_window_size (&w, &h);
gtk_window_set_default_size (window, w, h);
gtk_window_maximize (window);
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment