示例#1
0
文件: gailwindow.c 项目: Aridna/gtk2
static AtkStateSet*
gail_window_ref_state_set (AtkObject *accessible)
{
  AtkStateSet *state_set;
  GtkWidget *widget;
  GtkWindow *window;
  GdkWindowState state;

  state_set = ATK_OBJECT_CLASS (gail_window_parent_class)->ref_state_set (accessible);
  widget = GTK_ACCESSIBLE (accessible)->widget;
 
  if (widget == NULL)
    return state_set;

  window = GTK_WINDOW (widget);

  if (window->has_focus)
    atk_state_set_add_state (state_set, ATK_STATE_ACTIVE);

  if (widget->window)
    {
      state = gdk_window_get_state (widget->window);
      if (state & GDK_WINDOW_STATE_ICONIFIED)
        atk_state_set_add_state (state_set, ATK_STATE_ICONIFIED);
    } 
  if (gtk_window_get_modal (window))
    atk_state_set_add_state (state_set, ATK_STATE_MODAL);

  if (gtk_window_get_resizable (window))
    atk_state_set_add_state (state_set, ATK_STATE_RESIZABLE);
 
  return state_set;
}
示例#2
0
JNIEXPORT jboolean JNICALL
Java_org_gnome_gtk_GtkWindow_gtk_1window_1get_1resizable
(
	JNIEnv* env,
	jclass cls,
	jlong _self
)
{
	gboolean result;
	jboolean _result;
	GtkWindow* self;

	// convert parameter self
	self = (GtkWindow*) _self;

	// call function
	result = gtk_window_get_resizable(self);

	// cleanup parameter self

	// translate return value to JNI type
	_result = (jboolean) result;

	// and finally
	return _result;
}
示例#3
0
void wxTopLevelWindowGTK::DoSetClientSize(int width, int height)
{
    base_type::DoSetClientSize(width, height);

    // Since client size is being explicitly set, don't change it later
    // Has to be done after calling base because it calls SetSize,
    // which sets this true
    m_deferShowAllowed = false;

    if (m_wxwindow)
    {
        // If window is not resizable or not yet shown, set size request on
        // client widget, to make it more likely window will get correct size
        // even if our decorations size cache is incorrect (as it will be before
        // showing first TLW).
        if (!gtk_window_get_resizable(GTK_WINDOW(m_widget)))
        {
            gtk_widget_set_size_request(m_widget, -1, -1);
            gtk_widget_set_size_request(m_wxwindow, m_clientWidth, m_clientHeight);
        }
        else if (!IsShown())
        {
            gtk_widget_set_size_request(m_wxwindow, m_clientWidth, m_clientHeight);
            // Cancel size request at next idle to allow resizing
            g_idle_add_full(G_PRIORITY_LOW, reset_size_request, m_wxwindow, NULL);
        }
    }
}
示例#4
0
bool gMainWindow::isResizable()
{
	if (isTopLevel())
		return gtk_window_get_resizable(GTK_WINDOW(border));
	else
		return false;
}
示例#5
0
void wxTopLevelWindowGTK::GTKUpdateDecorSize(const DecorSize& decorSize)
{
    if (!IsMaximized() && !IsFullScreen())
        GetCachedDecorSize() = decorSize;
    if (m_updateDecorSize && memcmp(&m_decorSize, &decorSize, sizeof(DecorSize)))
    {
        m_useCachedClientSize = false;
        const wxSize diff(
            decorSize.left - m_decorSize.left + decorSize.right - m_decorSize.right,
            decorSize.top - m_decorSize.top + decorSize.bottom - m_decorSize.bottom);
        m_decorSize = decorSize;
        bool resized = false;
        if (m_minWidth > 0 || m_minHeight > 0 || m_maxWidth > 0 || m_maxHeight > 0)
        {
            // update size hints, they depend on m_decorSize
            DoSetSizeHints(m_minWidth, m_minHeight, m_maxWidth, m_maxHeight, m_incWidth, m_incHeight);
        }
        if (m_deferShow)
        {
            // keep overall size unchanged by shrinking m_widget
            int w, h;
            GTKDoGetSize(&w, &h);
            // but not if size would be less than minimum, it won't take effect
            if (w >= m_minWidth - (decorSize.left + decorSize.right) &&
                h >= m_minHeight - (decorSize.top + decorSize.bottom))
            {
                gtk_window_resize(GTK_WINDOW(m_widget), w, h);
                if (!gtk_window_get_resizable(GTK_WINDOW(m_widget)))
                    gtk_widget_set_size_request(GTK_WIDGET(m_widget), w, h);
                resized = true;
            }
        }
        if (!resized)
        {
            // adjust overall size to match change in frame extents
            m_width  += diff.x;
            m_height += diff.y;
            if (m_width  < 1) m_width  = 1;
            if (m_height < 1) m_height = 1;
            m_clientWidth = 0;
            gtk_widget_queue_resize(m_wxwindow);
        }
    }
    if (m_deferShow)
    {
        // gtk_widget_show() was deferred, do it now
        m_deferShow = false;
        DoGetClientSize(&m_clientWidth, &m_clientHeight);
        wxSizeEvent sizeEvent(GetSize(), GetId());
        sizeEvent.SetEventObject(this);
        HandleWindowEvent(sizeEvent);

        gtk_widget_show(m_widget);

        wxShowEvent showEvent(GetId(), true);
        showEvent.SetEventObject(this);
        HandleWindowEvent(showEvent);
    }
}
示例#6
0
void wxTopLevelWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags )
{
    wxCHECK_RET( m_widget, wxT("invalid frame") );

    // deal with the position first
    int old_x = m_x;
    int old_y = m_y;

    if ( !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
    {
        // -1 means "use existing" unless the flag above is specified
        if ( x != -1 )
            m_x = x;
        if ( y != -1 )
            m_y = y;
    }
    else // wxSIZE_ALLOW_MINUS_ONE
    {
        m_x = x;
        m_y = y;
    }

    const wxSize oldSize(m_width, m_height);
    if (width >= 0)
        m_width = width;
    if (height >= 0)
        m_height = height;
    ConstrainSize();
    if (m_width < 1) m_width = 1;
    if (m_height < 1) m_height = 1;

    if ( m_x != old_x || m_y != old_y )
    {
        gtk_window_move( GTK_WINDOW(m_widget), m_x, m_y );
        wxMoveEvent event(wxPoint(m_x, m_y), GetId());
        event.SetEventObject(this);
        HandleWindowEvent(event);
    }

    if (m_width != oldSize.x || m_height != oldSize.y)
    {
        m_deferShowAllowed = true;
        m_useCachedClientSize = false;

        int w, h;
        GTKDoGetSize(&w, &h);
        gtk_window_resize(GTK_WINDOW(m_widget), w, h);
        if (!gtk_window_get_resizable(GTK_WINDOW(m_widget)))
            gtk_widget_set_size_request(GTK_WIDGET(m_widget), w, h);

        DoGetClientSize(&m_clientWidth, &m_clientHeight);
        wxSizeEvent event(GetSize(), GetId());
        event.SetEventObject(this);
        HandleWindowEvent(event);
    }
}
示例#7
0
void af_window_set_height(int height)
{
    if (height < 0) return ;
    global_set("height", (gpointer)height);

    GtkWidget *window = global_get("window");

    if (gtk_window_get_resizable(GTK_WINDOW(window))) {
        gtk_window_resize(GTK_WINDOW(window), (gint)global_get("width"), (gint)global_get("height"));
    } else {
        gtk_widget_set_size_request(GTK_WIDGET(window), (gint)global_get("width"), (gint)global_get("height"));
    }
}
示例#8
0
int af_window_get_height()
{
    int width, height;
    GtkWidget *window = global_get("window");

    if (gtk_window_get_resizable(GTK_WINDOW(window))) {
        gtk_window_get_size(GTK_WINDOW(window), &width, &height);
    } else {
        gtk_widget_get_size_request(window, &width, &height);
    }

    return height;
}
示例#9
0
void
gnomemeeting_window_hide (GtkWidget *w)
{
  int x = 0;
  int y = 0;

  gchar *window_name = NULL;
  gchar *conf_key_size = NULL;
  gchar *conf_key_position = NULL;
  gchar *size = NULL;
  gchar *position = NULL;
  
  g_return_if_fail (w != NULL);
  
  window_name = (char *) g_object_get_data (G_OBJECT (w), "window_name");

  g_return_if_fail (window_name != NULL);
 
  conf_key_position =
    g_strdup_printf ("%s%s/position", USER_INTERFACE_KEY, window_name);
  conf_key_size =
    g_strdup_printf ("%s%s/size", USER_INTERFACE_KEY, window_name);

  
  /* If the window is visible, save its position and hide the window */
  if (gnomemeeting_window_is_visible (w)) {
    
    gtk_window_get_position (GTK_WINDOW (w), &x, &y);
    position = g_strdup_printf ("%d,%d", x, y);
    gm_conf_set_string (conf_key_position, position);
    g_free (position);

    if (gtk_window_get_resizable (GTK_WINDOW (w))) {

      gtk_window_get_size (GTK_WINDOW (w), &x, &y);
      size = g_strdup_printf ("%d,%d", x, y);
      gm_conf_set_string (conf_key_size, size);
      g_free (size);
    }

	
    gnomemeeting_threads_dialog_hide (w);
  }
    
  
  g_free (conf_key_position);
  g_free (conf_key_size);
}
示例#10
0
文件: gmwindow.c 项目: UIKit0/ekiga
void
gm_window_restore (GmWindow *self)
{
  int x = 0;
  int y = 0;

  gchar *size = NULL;
  gchar *position = NULL;
  gchar **couple = NULL;

  g_return_if_fail (g_strcmp0 (self->priv->key, "") && self);

  if (gtk_window_get_resizable (GTK_WINDOW (self))) {

    size = g_settings_get_string (self->priv->settings, "size");
    if (size)
      couple = g_strsplit (size, ",", 0);

    if (couple && couple [0])
      x = atoi (couple [0]);
    if (couple && couple [1])
      y = atoi (couple [1]);

    if (x > 0 && y > 0) {
      gtk_window_resize (GTK_WINDOW (self), x, y);
    }

    g_strfreev (couple);
    g_free (size);
  }

  position = g_settings_get_string (self->priv->settings, "position");
  if (position)
    couple = g_strsplit (position, ",", 0);

  if (couple && couple [0])
    x = atoi (couple [0]);
  if (couple && couple [1])
    y = atoi (couple [1]);

  if (x != 0 && y != 0)
    gtk_window_move (GTK_WINDOW (self), x, y);

  g_strfreev (couple);
  couple = NULL;
  g_free (position);
}
示例#11
0
文件: gmwindow.c 项目: UIKit0/ekiga
void
gm_window_save (GmWindow *self)
{
  gchar *size = NULL;
  gchar *position = NULL;

  g_return_if_fail (g_strcmp0 (self->priv->key, "") || self);

  position = g_strdup_printf ("%d,%d", self->priv->x, self->priv->y);
  g_settings_set_string (self->priv->settings, "position", position);
  g_free (position);

  if (gtk_window_get_resizable (GTK_WINDOW (self))) {

    size = g_strdup_printf ("%d,%d", self->priv->width, self->priv->height);
    g_settings_set_string (self->priv->settings, "size", size);
    g_free (size);
  }
}
示例#12
0
static void
gm_window_hide (GtkWidget *w,
                G_GNUC_UNUSED gpointer data)
{
  GmWindow *self = NULL;

  gchar *conf_key_size = NULL;
  gchar *conf_key_position = NULL;
  gchar *size = NULL;
  gchar *position = NULL;
  
  g_return_if_fail (w != NULL);
  
  self = GM_WINDOW (w);

  g_return_if_fail (strcmp (self->priv->key, ""));

  conf_key_position =
    g_strdup_printf ("%s/position", self->priv->key);
  conf_key_size =
    g_strdup_printf ("%s/size", self->priv->key);

  position = g_strdup_printf ("%d,%d", self->priv->x, self->priv->y);
  gm_conf_set_string (conf_key_position, position);
  g_free (position);

  if (gtk_window_get_resizable (GTK_WINDOW (w))) {

    size = g_strdup_printf ("%d,%d", self->priv->width, self->priv->height);
    gm_conf_set_string (conf_key_size, size);
    g_free (size);
  }
  
  g_free (conf_key_position);
  g_free (conf_key_size);
}
示例#13
0
void
gb_window_write_standard_source (GtkWidget * widget,
				 GbWidgetWriteSourceData * data,
				 gchar *title_p,
				 gchar *type_p,
				 gchar *position_p,
				 gchar *modal_p,
				 gchar *default_width_p,
				 gchar *default_height_p,
				 gchar *shrink_p,
				 gchar *grow_p,
				 gchar *auto_shrink_p,
				 gchar *wmname_p,
				 gchar *wmclass_p,
				 gchar *resizable_p,
				 gchar *destroy_with_parent_p,
				 gchar *icon_p)
{
  gint type, position, default_width, default_height;
#if 0
  gchar *wmname, *wmclass;
#endif

  if (title_p)
    {
      if (GTK_WINDOW (widget)->title
	  && strlen (GTK_WINDOW (widget)->title) > 0)
	source_add (data, "  gtk_window_set_title (GTK_WINDOW (%s), %s);\n",
		    data->wname,
		    source_make_string (GTK_WINDOW (widget)->title,
					data->use_gettext));
    }

  if (type_p)
    {
      type = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
						   type_p));
      if (type != GTK_WINDOW_TOPLEVEL)
	{
	  /* Note: there is no gtk_window_set_type () */
	  source_add (data, "  GTK_WINDOW (%s)->type = %s;\n",
		      data->wname, GbTypeSymbols[type]);
	}
    }

  if (position_p)
    {
      position = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
						       position_p));
      if (GbPositionValues[position] != GTK_WIN_POS_NONE)
	{
	  source_add (data,
		      "  gtk_window_set_position (GTK_WINDOW (%s), %s);\n",
		      data->wname, GbPositionSymbols[position]);
	}
    }

  if (modal_p)
    {
      if (gtk_object_get_data (GTK_OBJECT (widget), modal_p))
	{
	  source_add (data,
		      "  gtk_window_set_modal (GTK_WINDOW (%s), TRUE);\n",
		      data->wname);
	}
    }

  if (default_width_p && default_height_p)
    {
      default_width = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
							    DefaultWidth));
      default_height = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
							     DefaultHeight));
      if (default_width || default_height )
	{
	  source_add (data,
		      "  gtk_window_set_default_size (GTK_WINDOW (%s), %i, %i);\n",
		      data->wname,
		      default_width ? default_width : -1,
		      default_height ? default_height : -1);
	}
    }

#if 0
  if (shrink_p && grow_p)
    {
      if (GTK_WINDOW (widget)->allow_grow != TRUE
	  || GTK_WINDOW (widget)->allow_shrink != FALSE)
	source_add (data,
		    "  gtk_window_set_policy (GTK_WINDOW (%s), %s, %s, %s);\n",
		    data->wname,
		    GTK_WINDOW (widget)->allow_shrink ? "TRUE" : "FALSE",
		    GTK_WINDOW (widget)->allow_grow ? "TRUE" : "FALSE",
		    "FALSE");
    }
#endif

#if 0
  /* These aren't necessary, and have been used incorrectly for ages. */
  if (wmname_p && wmclass_p)
    {
      wmname = gtk_object_get_data (GTK_OBJECT (widget), wmname_p);
      wmclass = gtk_object_get_data (GTK_OBJECT (widget), wmclass_p);
      if (wmname || wmclass)
	{
	  source_add (data,
		      "  gtk_window_set_wmclass (GTK_WINDOW (%s), %s,",
		      data->wname,
		      wmname ? source_make_string (wmname, FALSE) : "\"\"");
	  source_add (data, " %s);\n",
		      wmclass ? source_make_string (wmclass, FALSE) : "\"\"");
	}
    }
#endif

  if (resizable_p)
    {
      if (!gtk_window_get_resizable (GTK_WINDOW (widget)))
	source_add (data,
		    "  gtk_window_set_resizable (GTK_WINDOW (%s), FALSE);\n",
		    data->wname);
    }

  if (destroy_with_parent_p)
    {
      if (gtk_window_get_destroy_with_parent (GTK_WINDOW (widget)))
	source_add (data,
	"  gtk_window_set_destroy_with_parent (GTK_WINDOW (%s), TRUE);\n",
		    data->wname);
    }

  if (icon_p)
    {
      gchar *filename = gtk_object_get_data (GTK_OBJECT (widget), icon_p);
      if (filename && *filename)
	{
	  char *pixbuf_name = g_strdup_printf ("%s_icon_pixbuf", data->wname);

	  source_add_decl (data, "  GdkPixbuf *%s;\n", pixbuf_name);
	  source_create_pixbuf (data, pixbuf_name, filename);
	  source_add (data,
		      "  if (%s)\n"
		      "    {\n"
		      "      gtk_window_set_icon (GTK_WINDOW (%s), %s);\n"
		      "      gdk_pixbuf_unref (%s);\n"
		      "    }\n",
		      pixbuf_name,
		      data->wname, pixbuf_name,
		      pixbuf_name);

	  g_free (pixbuf_name);
	}
    }
}
示例#14
0
void
gb_window_get_standard_properties (GtkWidget * widget,
				   GbWidgetGetArgData * data,
				   gchar *title_p,
				   gchar *type_p,
				   gchar *position_p,
				   gchar *modal_p,
				   gchar *default_width_p,
				   gchar *default_height_p,
				   gchar *shrink_p,
				   gchar *grow_p,
				   gchar *auto_shrink_p,
				   gchar *wmname_p,
				   gchar *wmclass_p,
				   gchar *resizable_p,
				   gchar *destroy_with_parent_p,
				   gchar *icon_p)
{
  gint type, position, default_width, default_height;

  if (title_p)
    gb_widget_output_translatable_string (data, title_p,
					  GTK_WINDOW (widget)->title);

  /* The type is stored in the object datalist as we can't change it after the
     window is realized. It will default to 0, which is OK. */
  if (type_p)
    {
      type = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
						   type_p));
      gb_widget_output_choice (data, type_p, type, GbTypeSymbols[type]);
    }

  /* The position is stored in the object datalist so that it doesn't affect
     the displaying of the window within Glade. It will default to 0, i.e.
     GTK_WIN_POS_NONE, which is OK. */
  if (position_p)
    {
      position = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
						       position_p));
      gb_widget_output_choice (data, position_p, position,
			       GbPositionSymbols[position]);
    }

  if (modal_p)
    {
      gb_widget_output_bool (data, modal_p,
			     gtk_object_get_data (GTK_OBJECT (widget), modal_p)
			     != NULL ? TRUE : FALSE);
    }

  if (default_width_p && default_height_p)
    {
      default_width = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
							    DefaultWidth));
      gb_widget_output_optional_int (data, default_width_p, default_width,
				     default_width != 0 ? TRUE : FALSE);

      default_height = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget),
							     DefaultHeight));
      gb_widget_output_optional_int (data, default_height_p, default_height,
				     default_height != 0 ? TRUE : FALSE);
    }

#if 0
  /* These are deprecated. */
  if (grow_p && shrink_p)
    {
      gb_widget_output_bool (data, grow_p,
			     GTK_WINDOW (widget)->allow_grow);
      gb_widget_output_bool (data, shrink_p,
			     GTK_WINDOW (widget)->allow_shrink);
    }
#endif

  /* These are stored in the object hash since we can't set them after the
     window is realized. */
#if 0
  /* These aren't necessary, and have been used incorrectly for ages. */
  if (wmname_p)
    gb_widget_output_string (data, wmname_p,
			     gtk_object_get_data (GTK_OBJECT (widget),
						  wmname_p));
  if (wmclass_p)
    gb_widget_output_string (data, wmclass_p,
			     gtk_object_get_data (GTK_OBJECT (widget),
						  wmclass_p));
#endif

  if (resizable_p)
    gb_widget_output_bool (data, resizable_p,
			   gtk_window_get_resizable (GTK_WINDOW (widget)));

  if (destroy_with_parent_p)
    gb_widget_output_bool (data, destroy_with_parent_p,
			   gtk_window_get_destroy_with_parent (GTK_WINDOW (widget)));

  if (icon_p)
    gb_widget_output_pixmap_filename (data, icon_p,
				      gtk_object_get_data (GTK_OBJECT (widget),
							   icon_p));
}
示例#15
0
static int init_setting(GtkWidget * window, GtkWidget * view)
{
    gint root_x, root_y;
    gint screen_width, screen_height;
    /* Setting Window */
    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
    gtk_window_set_title(GTK_WINDOW(window), global_get("title"));
    gtk_widget_set_size_request(GTK_WIDGET(window), 10, 10);
    gtk_window_set_resizable(GTK_WINDOW(window), (gboolean)global_get("resizeable"));
    gtk_window_set_decorated(GTK_WINDOW(window), (gboolean)global_get("border"));

    if (gtk_window_get_resizable(GTK_WINDOW(window))) {
        gtk_window_resize(GTK_WINDOW(window), (gint)global_get("width"), (gint)global_get("height"));
    } else {
        gtk_widget_set_size_request(GTK_WIDGET(window), (gint)global_get("width"), (gint)global_get("height"));
    }

    /* Move Window */
    screen_get_size(&screen_width, &screen_height);

    root_x = (screen_width - (gint)global_get("width")) / 2;
    root_y = (screen_height - (gint)global_get("height")) / 2;

    if ((gint)global_get("x") != 10000) root_x = (gint)global_get("x");
    if ((gint)global_get("y") != 10000) root_y = (gint)global_get("y");

    if (root_x < 0) root_x = screen_width + root_x;
    if (root_y < 0) root_y = screen_height + root_y;

    gtk_window_move(GTK_WINDOW(window), root_x, root_y);

    /* Setting Icon */
    if (g_file_test(global_get("icon"), G_FILE_TEST_EXISTS)) {
        gtk_window_set_icon_from_file(GTK_WINDOW(window), global_get("icon"), NULL);
    }
    /* Fullscreen */
    if ((gboolean)global_get("fullscreen")) af_window_set_fullscreen(TRUE);


    g_signal_connect(G_OBJECT(window), "destroy", G_CALLBACK(af_exit), NULL);
    g_signal_connect(G_OBJECT(window), "window-state-event", G_CALLBACK(window_onstatechange), NULL);

    /* Setting Webkit */
    WebKitWebSettings *setting = webkit_web_view_get_settings (WEBKIT_WEB_VIEW(view));

    g_object_set(G_OBJECT(setting), "default-encoding", global_get("encode"), NULL);
    g_object_set(G_OBJECT(setting), "enable-webgl", TRUE, NULL);
    //g_object_set(G_OBJECT(view), "self-scrolling", TRUE, NULL);
    g_object_set(G_OBJECT(setting), "default-font-family", "SimSun", NULL);
    g_object_set(G_OBJECT(setting), "monospace-font-family", "SimSun", NULL);
    g_object_set(G_OBJECT(setting), "sans-serif-font-family", "SimSun", NULL);
    g_object_set(G_OBJECT(setting), "serif-font-family", "SimSun", NULL);
    g_object_set(G_OBJECT(setting), "cursive-font-family", "SimSun", NULL);

    webkit_web_view_set_settings(WEBKIT_WEB_VIEW(view), setting);

    g_signal_connect(WEBKIT_WEB_VIEW(view), "window-object-cleared", G_CALLBACK(js_callback), NULL);
    g_signal_connect(WEBKIT_WEB_VIEW(view), "close-web-view", G_CALLBACK(webview_onclose), NULL);

    return 0;
}
示例#16
0
gboolean af_window_get_resizable()
{
    GtkWidget *window = global_get("window");
    return gtk_window_get_resizable(GTK_WINDOW(window));
}
示例#17
0
void
gnomemeeting_window_show (GtkWidget *w)
{
  int x = 0;
  int y = 0;

  gchar *window_name = NULL;
  gchar *conf_key_size = NULL;
  gchar *conf_key_position = NULL;
  gchar *size = NULL;
  gchar *position = NULL;
  gchar **couple = NULL;
  
  g_return_if_fail (w != NULL);
  
  window_name = (char *) g_object_get_data (G_OBJECT (w), "window_name");

  g_return_if_fail (window_name != NULL);
  
  conf_key_position =
    g_strdup_printf ("%s%s/position", USER_INTERFACE_KEY, window_name);
  conf_key_size =
    g_strdup_printf ("%s%s/size", USER_INTERFACE_KEY, window_name);  

  if (!gnomemeeting_window_is_visible (w)) {
    
    position = gm_conf_get_string (conf_key_position);
    if (position)
      couple = g_strsplit (position, ",", 0);

    if (couple && couple [0])
      x = atoi (couple [0]);
    if (couple && couple [1])
      y = atoi (couple [1]);


    if (x != 0 && y != 0)
      gtk_window_move (GTK_WINDOW (w), x, y);

    g_strfreev (couple);
    couple = NULL;
    g_free (position);


    if (gtk_window_get_resizable (GTK_WINDOW (w))) {

      size = gm_conf_get_string (conf_key_size);
      if (size)
	couple = g_strsplit (size, ",", 0);

      if (couple && couple [0])
	x = atoi (couple [0]);
      if (couple && couple [1])
	y = atoi (couple [1]);

      if (x > 0 && y > 0)
	gtk_window_resize (GTK_WINDOW (w), x, y);

      g_strfreev (couple);
      g_free (size);
    }

    gnomemeeting_threads_dialog_show (w);
  }
  
  g_free (conf_key_position);
  g_free (conf_key_size);
}
示例#18
0
static void
gm_window_show (GtkWidget *w,
                G_GNUC_UNUSED gpointer data)
{
  int x = 0;
  int y = 0;

  GmWindow *self = NULL;

  gchar *conf_key_size = NULL;
  gchar *conf_key_position = NULL;
  gchar *size = NULL;
  gchar *position = NULL;
  gchar **couple = NULL;

  g_return_if_fail (w != NULL);
  
  self = GM_WINDOW (w);

  g_return_if_fail (strcmp (self->priv->key, ""));

  conf_key_position =
    g_strdup_printf ("%s/position", self->priv->key);
  conf_key_size =
    g_strdup_printf ("%s/size", self->priv->key);

  if (gtk_window_get_resizable (GTK_WINDOW (w))) {

    size = gm_conf_get_string (conf_key_size);
    if (size)
      couple = g_strsplit (size, ",", 0);

    if (couple && couple [0])
      x = atoi (couple [0]);
    if (couple && couple [1])
      y = atoi (couple [1]);

    if (x > 0 && y > 0) {
      gtk_window_resize (GTK_WINDOW (w), x, y);
    }

    g_strfreev (couple);
    g_free (size);
  }

  position = gm_conf_get_string (conf_key_position);
  if (position)
    couple = g_strsplit (position, ",", 0);

  if (couple && couple [0])
    x = atoi (couple [0]);
  if (couple && couple [1])
    y = atoi (couple [1]);

  if (x != 0 && y != 0)
    gtk_window_move (GTK_WINDOW (w), x, y);

  g_strfreev (couple);
  couple = NULL;
  g_free (position);

  gtk_widget_realize (GTK_WIDGET (w));

  g_free (conf_key_position);
  g_free (conf_key_size);
}