• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GTK_IS_WINDOW函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GTK_IS_WINDOW函数的典型用法代码示例。如果您正苦于以下问题:C++ GTK_IS_WINDOW函数的具体用法?C++ GTK_IS_WINDOW怎么用?C++ GTK_IS_WINDOW使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GTK_IS_WINDOW函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: button_clicked_entry_browse_directory

inline void button_clicked_entry_browse_directory (GtkWidget* widget, GtkEntry* entry)
{
	gtkutil::FileChooser dirChooser(gtk_widget_get_toplevel(widget), _("Choose Directory"), true, true);
	std::string curEntry = gtk_entry_get_text(entry);

	if (g_path_is_absolute(curEntry.c_str()))
		curEntry.clear();
	dirChooser.setCurrentPath(curEntry);

	std::string filename = dirChooser.display();

	if (GTK_IS_WINDOW(gtk_widget_get_toplevel(widget))) {
		gtk_window_present(GTK_WINDOW(gtk_widget_get_toplevel(widget)));
	}

	if (!filename.empty()) {
		gtk_entry_set_text(entry, filename.c_str());
	}
}
开发者ID:chrisglass,项目名称:ufoai,代码行数:19,代码来源:dialog.cpp


示例2: gdict_show_pref_dialog

void
gdict_show_pref_dialog (GtkWidget         *parent,
			const gchar       *title,
			GdictSourceLoader *loader)
{
  GtkWidget *dialog;
  
  g_return_if_fail (GTK_IS_WIDGET (parent));
  g_return_if_fail (GDICT_IS_SOURCE_LOADER (loader));
  
  if (parent != NULL)
    dialog = g_object_get_data (G_OBJECT (parent), "gdict-pref-dialog");
  else
    dialog = global_dialog;
  
  if (dialog == NULL)
    {
      dialog = g_object_new (GDICT_TYPE_PREF_DIALOG,
                             "source-loader", loader,
                             "title", title,
                             NULL);
      
      g_object_ref_sink (dialog);
      
      g_signal_connect (dialog, "delete-event",
                        G_CALLBACK (gtk_widget_hide_on_delete),
                        NULL);
      
      if (parent != NULL && GTK_IS_WINDOW (parent))
        {
          gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (parent));
          gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
          g_object_set_data_full (G_OBJECT (parent), "gdict-pref-dialog",
                                  dialog,
                                  g_object_unref);
        }
      else
        global_dialog = dialog;
    }

  gtk_window_set_screen (GTK_WINDOW (dialog), gtk_widget_get_screen (parent));
  gtk_window_present (GTK_WINDOW (dialog));
}
开发者ID:NitikaAgarwal,项目名称:gnome-dictionary,代码行数:43,代码来源:gdict-pref-dialog.c


示例3: ag_app_peek_first_window

GtkWindow *
ag_app_peek_first_window(AgApp *app)
{
    GList *l;

    for (
                l = gtk_application_get_windows(GTK_APPLICATION(app));
                l;
                l = g_list_next(l)
            ) {
        if (GTK_IS_WINDOW(l->data)) {
            return GTK_WINDOW(l->data);
        }
    }

    ag_app_new_window(app);

    return ag_app_peek_first_window(app);
}
开发者ID:gergelypolonkai,项目名称:astrognome,代码行数:19,代码来源:ag-app.c


示例4: gtk_font_button_clicked

static void
gtk_font_button_clicked (GtkButton *button)
{
  GtkFontSelectionDialog *font_dialog;
  GtkFontButton    *font_button = GTK_FONT_BUTTON (button);
  
  if (!font_button->priv->font_dialog) 
    {
      GtkWidget *parent;
      
      parent = gtk_widget_get_toplevel (GTK_WIDGET (font_button));
      
      font_button->priv->font_dialog = gtk_font_selection_dialog_new (font_button->priv->title);
      
      font_dialog = GTK_FONT_SELECTION_DIALOG (font_button->priv->font_dialog);
      
      if (GTK_WIDGET_TOPLEVEL (parent) && GTK_IS_WINDOW (parent))
        {
          if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (font_dialog)))
 	    gtk_window_set_transient_for (GTK_WINDOW (font_dialog), GTK_WINDOW (parent));
	       
	  gtk_window_set_modal (GTK_WINDOW (font_dialog),
				gtk_window_get_modal (GTK_WINDOW (parent)));
	}

      g_signal_connect (font_dialog->ok_button, "clicked",
                        G_CALLBACK (dialog_ok_clicked), font_button);
      g_signal_connect (font_dialog->cancel_button, "clicked",
			G_CALLBACK (dialog_cancel_clicked), font_button);
      g_signal_connect (font_dialog, "destroy",
                        G_CALLBACK (dialog_destroy), font_button);
    }
  
  if (!GTK_WIDGET_VISIBLE (font_button->priv->font_dialog)) 
    {
      font_dialog = GTK_FONT_SELECTION_DIALOG (font_button->priv->font_dialog);
      
      gtk_font_selection_dialog_set_font_name (font_dialog, font_button->priv->fontname);
      
    } 

  gtk_window_present (GTK_WINDOW (font_button->priv->font_dialog));
}
开发者ID:batman52,项目名称:dingux-code,代码行数:43,代码来源:gtkfontbutton.c


示例5: ag_app_buttoned_dialog

GtkResponseType
ag_app_buttoned_dialog(GtkWindow      *window,
                       GtkMessageType message_type,
                       const gchar    *message,
                       const gchar    *first_button_text,
                       ...)
{
    va_list     ap;
    const gchar *button_text;
    gint        response_id;
    GtkWidget   *dialog;

    g_return_val_if_fail(GTK_IS_WINDOW(window), GTK_RESPONSE_NONE);

    dialog = gtk_message_dialog_new(
            window,
            GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
            message_type,
            GTK_BUTTONS_NONE,
            "%s",
            message
        );

    if (first_button_text) {
        button_text = first_button_text;

        va_start(ap, first_button_text);
        response_id = va_arg(ap, gint);
        gtk_dialog_add_button(GTK_DIALOG(dialog), button_text, response_id);

        while ((button_text = va_arg(ap, gchar *)) != NULL) {
            response_id = va_arg(ap, gint);
            gtk_dialog_add_button(GTK_DIALOG(dialog), button_text, response_id);
        }

        va_end(ap);
    }

    response_id = gtk_dialog_run(GTK_DIALOG(dialog));
    gtk_widget_destroy(dialog);

    return response_id;
}
开发者ID:gergelypolonkai,项目名称:astrognome,代码行数:43,代码来源:ag-app.c


示例6: state_event_watcher

static gboolean
state_event_watcher (GSignalInvocationHint *hint,
                     guint                  n_param_values,
                     const GValue          *param_values,
                     gpointer               data)
{
  GObject *object;
  GtkWidget *widget;
  AtkObject *atk_obj;
  AtkObject *parent;
  GdkEventWindowState *event;
  gchar *signal_name;

  object = g_value_get_object (param_values + 0);
  if (!GTK_IS_WINDOW (object))
    return FALSE;

  event = g_value_get_boxed (param_values + 1);
  if (event->type == GDK_WINDOW_STATE)
    return FALSE;
  widget = GTK_WIDGET (object);

  if (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED)
    signal_name = "maximize";
  else if (event->new_window_state & GDK_WINDOW_STATE_ICONIFIED)
    signal_name = "minimize";
  else if (event->new_window_state == 0)
    signal_name = "restore";
  else
    return TRUE;

  atk_obj = gtk_widget_get_accessible (widget);
  if (GTK_IS_WINDOW_ACCESSIBLE (atk_obj))
    {
      parent = atk_object_get_parent (atk_obj);
      if (parent == atk_get_root ())
        g_signal_emit_by_name (atk_obj, signal_name);

      return TRUE;
    }

  return FALSE;
}
开发者ID:endlessm,项目名称:gtk,代码行数:43,代码来源:gtkaccessibility.c


示例7: rbgtk_initialize_gtkobject

void
rbgtk_initialize_gtkobject(VALUE obj, GtkObject *gtkobj)
{
    gtkobj = g_object_ref(gtkobj);
    gtk_object_sink(gtkobj);
    G_INITIALIZE(obj, gtkobj);

    if (GTK_IS_WINDOW(gtkobj) || GTK_IS_MENU_SHELL(gtkobj)) {
        VALUE klass;
        klass = rb_obj_class(obj);
        if (rb_ivar_defined(klass, id__windows__) == Qfalse) {
            rb_ivar_set(klass, id__windows__, rb_hash_new());
        }
        rb_hash_aset(rb_ivar_get(klass, id__windows__), obj, Qnil);
        g_signal_connect_after(gtkobj, "destroy",
                               G_CALLBACK(remove_from_windows),
                               (gpointer)obj);
    }
}
开发者ID:benolee,项目名称:ruby-gnome2,代码行数:19,代码来源:rbgtk.c


示例8: find_topmost_widget_coords_from_event

/* Ignores (x, y) on input, translates event coordinates to
 * allocation relative (x, y) of the returned widget.
 */
static GtkWidget *
find_topmost_widget_coords_from_event (GdkEvent *event,
				       gint     *x,
				       gint     *y)
{
  GtkAllocation allocation;
  gint tx, ty;
  gdouble dx, dy;
  GtkWidget *tmp;

  gdk_event_get_coords (event, &dx, &dy);

  /* Returns coordinates relative to tmp's allocation. */
  tmp = _gtk_widget_find_at_coords (event->any.window, dx, dy, &tx, &ty);

  if (!tmp)
    return NULL;

  /* Make sure the pointer can actually be on the widget returned. */
  gtk_widget_get_allocation (tmp, &allocation);
  allocation.x = 0;
  allocation.y = 0;
  if (GTK_IS_WINDOW (tmp))
    {
      GtkBorder border;
      _gtk_window_get_shadow_width (GTK_WINDOW (tmp), &border);
      allocation.x = border.left;
      allocation.y = border.top;
      allocation.width -= border.left + border.right;
      allocation.height -= border.top + border.bottom;
    }

  if (tx < allocation.x || tx >= allocation.width ||
      ty < allocation.y || ty >= allocation.height)
    return NULL;

  if (x)
    *x = tx;
  if (y)
    *y = ty;

  return tmp;
}
开发者ID:Vasileus,项目名称:gtk,代码行数:46,代码来源:gtktooltip.c


示例9: games_settings_bind_window_state

/**
 * games_settings_bind_window_state:
 * @path: a valid #GSettings path
 * @window: a #GtkWindow
 *
 * Restore the window configuration, and persist changes to the window configuration:
 * window width and height, and maximised and fullscreen state.
 * @window must not be realised yet.
 *
 * To make sure the state is saved at exit, g_settings_sync() must be called.
 */
void
games_settings_bind_window_state (const char *path,
                                  GtkWindow *window)
{
  WindowState *state;
  int width, height;
  gboolean maximised, fullscreen;

  g_return_if_fail (GTK_IS_WINDOW (window));
  g_return_if_fail (!gtk_widget_get_realized (GTK_WIDGET (window)));

  state = g_slice_new0 (WindowState);

  state->window = window;
  state->settings = g_settings_new_with_path (SCHEMA_NAME, path);

  /* We delay storing the state until exit */
  g_settings_delay (state->settings);

  g_object_set_data_full (G_OBJECT (window), "GamesSettings::WindowState",
                          state, (GDestroyNotify) free_window_state);

  g_signal_connect (window, "configure-event",
                    G_CALLBACK (window_configure_event_cb), state);
  g_signal_connect (window, "window-state-event",
                    G_CALLBACK (window_state_event_cb), state);

  maximised = g_settings_get_boolean (state->settings, STATE_KEY_MAXIMIZED);
  fullscreen = g_settings_get_boolean (state->settings, STATE_KEY_FULLSCREEN);
  width = g_settings_get_int (state->settings, STATE_KEY_WIDTH);
  height = g_settings_get_int (state->settings, STATE_KEY_HEIGHT);

  if (width > 0 && height > 0) {
    gtk_window_set_default_size (GTK_WINDOW (window), width, height);
  }
  if (maximised) {
    gtk_window_maximize (GTK_WINDOW (window));
  }
  if (fullscreen) {
    gtk_window_fullscreen (GTK_WINDOW (window));
  }
}
开发者ID:bellau,项目名称:gnome-games,代码行数:53,代码来源:games-settings.c


示例10: n_param

/**
 * @fn void *startROS (void *user)
 * @brief ROS thread.
 * 
 * The main program wait until "ros_param_read" in order to allow the <br>
 * ROS params to be also the Gtk Window and Widgets params.
 * Then the ROS thread wait to the widgets creation before subcribing<br>
 * to any topics, avoid to call public widget function for a widget not<br>
 * yet created.
 */
void *startROS (void *user)
{
  if (user != NULL)
  {
    struct arg *p_arg = (arg *) user;

    ros::init (p_arg->argc, p_arg->argv, "gpsd_viewer");
    ros::NodeHandle n;

    std::string local_path;
    std::string package_path = ros::package::getPath (ROS_PACKAGE_NAME);
    ros::NodeHandle n_param ("~");
    XmlRpc::XmlRpcValue xml_marker_center;

    ROS_INFO ("Starting GPSD Viewer");

	 // -----------------------------------------------------------------      
    // **** allow widget creation
    data->ros_param_read = true;

    // **** wait to widget creation
    while (!data->widget_created)
    {
      ROS_DEBUG ("Waiting widgets creation");
    }

    // -----------------------------------------------------------------      
    // **** topics subscribing
	 ros::Subscriber fix_sub;
    fix_sub = n.subscribe ("/fix", 1, &gpsFixCallback);
    pub_cmd= n.advertise<gpsd_viewer::cmd>("cmd",5);
    ROS_INFO ("Spinning");
    ros::spin ();
  }

  // **** stop the gtk main loop
  if (GTK_IS_WINDOW (data->window))
  {
    gtk_main_quit ();
  }
  pthread_exit (NULL);
}
开发者ID:skkaul,项目名称:raven,代码行数:52,代码来源:gpsd_viewer.cpp


示例11: sp_window_settings__window_realize

static void
sp_window_settings__window_realize (GtkWindow *window)
{
  GtkApplication *app;
  GdkRectangle geom = { 0 };
  gboolean maximized = FALSE;
  GList *list;
  guint count = 0;

  g_assert (GTK_IS_WINDOW (window));
  g_assert (G_IS_SETTINGS (settings));

  g_settings_get (settings, "window-position", "(ii)", &geom.x, &geom.y);
  g_settings_get (settings, "window-size", "(ii)", &geom.width, &geom.height);
  g_settings_get (settings, "window-maximized", "b", &maximized);

  geom.width = MAX (geom.width, WINDOW_MIN_WIDTH);
  geom.height = MAX (geom.height, WINDOW_MIN_HEIGHT);
  gtk_window_set_default_size (window, geom.width, geom.height);

  /*
   * If there are other windows currently visible other than this one,
   * then ignore positioning and let the window manager decide.
   */
  count = 0;
  app = GTK_APPLICATION (g_application_get_default ());
  list = gtk_application_get_windows (app);
  for (; list != NULL; list = list->next)
    {
      GtkWindow *ele = list->data;

      if (SP_IS_WINDOW (ele) && (ele != window) &&
          gtk_widget_get_visible (GTK_WIDGET (window)))
        count++;
    }

  if (count == 0)
    gtk_window_move (window, geom.x, geom.y);

  if (maximized)
    gtk_window_maximize (window);
}
开发者ID:GNOME,项目名称:sysprof,代码行数:42,代码来源:sp-window-settings.c


示例12: eel_gtk_window_set_initial_geometry_from_string

/**
 * eel_gtk_window_set_initial_geometry_from_string:
 *
 * Sets the position and size of a GtkWindow before the
 * GtkWindow is shown. The geometry is passed in as a string.
 * It is an error to call this on a window that
 * is already on-screen. Takes into account screen size, and does
 * some sanity-checking on the passed-in values.
 *
 * @window: A non-visible GtkWindow
 * @geometry_string: A string suitable for use with eel_gdk_parse_geometry
 * @minimum_width: If the width from the string is smaller than this,
 * use this for the width.
 * @minimum_height: If the height from the string is smaller than this,
 * use this for the height.
 * @ignore_position: If true position data from string will be ignored.
 */
void
eel_gtk_window_set_initial_geometry_from_string (GtkWindow *window,
        const char *geometry_string,
        guint minimum_width,
        guint minimum_height,
        gboolean ignore_position)
{
    int left, top;
    guint width, height;
    EelGdkGeometryFlags geometry_flags;

    g_return_if_fail (GTK_IS_WINDOW (window));
    g_return_if_fail (geometry_string != NULL);

    /* Setting the default size doesn't work when the window is already showing.
     * Someday we could make this move an already-showing window, but we don't
     * need that functionality yet.
     */
    g_return_if_fail (!gtk_widget_get_visible (GTK_WIDGET (window)));

    geometry_flags = eel_gdk_parse_geometry (geometry_string, &left, &top, &width, &height);

    /* Make sure the window isn't smaller than makes sense for this window.
     * Other sanity checks are performed in set_initial_geometry.
     */
    if (geometry_flags & EEL_GDK_WIDTH_VALUE)
    {
        width = MAX (width, minimum_width);
    }
    if (geometry_flags & EEL_GDK_HEIGHT_VALUE)
    {
        height = MAX (height, minimum_height);
    }

    /* Ignore saved window position if requested. */
    if (ignore_position)
    {
        geometry_flags &= ~(EEL_GDK_X_VALUE | EEL_GDK_Y_VALUE);
    }

    eel_gtk_window_set_initial_geometry (window, geometry_flags, left, top, width, height);
}
开发者ID:City-busz,项目名称:caja,代码行数:59,代码来源:eel-gtk-extensions.c


示例13: button_clicked_entry_browse_file

inline void button_clicked_entry_browse_file (GtkWidget* widget, GtkEntry* entry)
{
	std::string filename = gtk_entry_get_text(entry);

	gtkutil::FileChooser fileChooser(gtk_widget_get_toplevel(widget), _("Choose File"), true, false);
	if (!filename.empty()) {
		fileChooser.setCurrentPath(os::stripFilename(filename));
		fileChooser.setCurrentFile(filename);
	}

	std::string file = fileChooser.display();

	if (GTK_IS_WINDOW(gtk_widget_get_toplevel(widget))) {
		gtk_window_present(GTK_WINDOW(gtk_widget_get_toplevel(widget)));
	}

	if (!file.empty()) {
		gtk_entry_set_text(entry, file.c_str());
	}
}
开发者ID:chrisglass,项目名称:ufoai,代码行数:20,代码来源:dialog.cpp


示例14: dh_preferences_show_dialog

void
dh_preferences_show_dialog (GtkWindow *parent)
{
        g_return_if_fail (GTK_IS_WINDOW (parent));

        if (prefs_dialog == NULL) {
                prefs_dialog = GTK_WIDGET (g_object_new (DH_TYPE_PREFERENCES, NULL));
                g_signal_connect (prefs_dialog,
                                  "destroy",
                                  G_CALLBACK (gtk_widget_destroyed),
                                  &prefs_dialog);
        }

        if (parent != gtk_window_get_transient_for (GTK_WINDOW (prefs_dialog))) {
                gtk_window_set_transient_for (GTK_WINDOW (prefs_dialog),
                                              parent);
        }

        gtk_window_present (GTK_WINDOW (prefs_dialog));
}
开发者ID:MarkRijckenberg,项目名称:devhelp,代码行数:20,代码来源:dh-preferences.c


示例15: gwy_app_wait_start

/**
 * gwy_app_wait_start:
 * @window: A window.
 * @message: A message to show in the wait dialog.
 *
 * Starts waiting for a window @window, creating a dialog with a progress bar.
 *
 * Waiting is global, there can be only one at a time.
 **/
void
gwy_app_wait_start(GtkWidget *window,
                   const gchar *message)
{
    if (window && !GTK_IS_WINDOW(window))
        g_warning("Widget is not a window");

    if (wait_widget || silent_waiting) {
        g_warning("Already waiting on a widget, switching to the new one");
        gwy_app_wait_switch_widget(window, message);
        return;
    }

    canceled = FALSE;
    if (!window)
        silent_waiting = TRUE;
    else
        gwy_app_wait_create_dialog(window, message);
    wait_widget = window;
}
开发者ID:svn2github,项目名称:gwyddion,代码行数:29,代码来源:wait.c


示例16: _window_configure_cb

static gboolean
_window_configure_cb (GtkWidget *widget,
                      GdkEventConfigure *event,
                      gpointer user_data)
{
  ol_assert_ret (GTK_IS_WINDOW (widget), FALSE);
  OlScrollModule *module = (OlScrollModule*) user_data;
  if (module == NULL)
    return FALSE;
  if (_config_is_setting)
    return FALSE;
  _config_is_setting = TRUE;
  gint width, height;
  OlConfigProxy *config = ol_config_proxy_get_instance ();
  gtk_window_get_size (GTK_WINDOW (widget), &width, &height);
  ol_config_proxy_set_int (config, "ScrollMode/width", width);
  ol_config_proxy_set_int (config, "ScrollMode/height", height);
  _config_is_setting = FALSE;
  return FALSE;
}
开发者ID:PedroHLC,项目名称:osdlyrics,代码行数:20,代码来源:ol_scroll_module.c


示例17: gimp_display_shell_close_name_changed

static void
gimp_display_shell_close_name_changed (GimpImage      *image,
                                       GimpMessageBox *box)
{
  GtkWidget *window = gtk_widget_get_toplevel (GTK_WIDGET (box));

  if (GTK_IS_WINDOW (window))
    {
      gchar *title = g_strdup_printf (_("Close %s"),
				      gimp_image_get_display_name (image));

      gtk_window_set_title (GTK_WINDOW (window), title);
      g_free (title);
    }

  gimp_message_box_set_primary_text (box,
                                     _("Save the changes to image '%s' "
                                       "before closing?"),
                                     gimp_image_get_display_name (image));
}
开发者ID:MichaelMure,项目名称:Gimp-Cage-Tool,代码行数:20,代码来源:gimpdisplayshell-close.c


示例18: find_action_owner

static GObject *
find_action_owner (GtkActionable *actionable)
{
  GtkWidget *widget = GTK_WIDGET (actionable);
  const gchar *full_name;
  const gchar *dot;
  const gchar *name;
  gchar *prefix;
  GtkWidget *win;
  GActionGroup *group;

  full_name = gtk_actionable_get_action_name (actionable);
  if (!full_name)
    return NULL;

  dot = strchr (full_name, '.');
  prefix = g_strndup (full_name, dot - full_name);
  name = dot + 1;

  win = gtk_widget_get_ancestor (widget, GTK_TYPE_APPLICATION_WINDOW);
  if (g_strcmp0 (prefix, "win") == 0)
    {
      if (G_IS_OBJECT (win))
        return (GObject *)win;
    }
  else if (g_strcmp0 (prefix, "app") == 0)
    {  
      if (GTK_IS_WINDOW (win))
        return (GObject *)gtk_window_get_application (GTK_WINDOW (win));
    }

  while (widget != NULL)
    {
      group = _gtk_widget_get_action_group (widget, prefix);
      if (group && g_action_group_has_action (group, name))
        return (GObject *)widget;
      widget = action_ancestor (widget);
    }

  return NULL;  
}
开发者ID:3v1n0,项目名称:gtk,代码行数:41,代码来源:prop-editor.c


示例19: gedit_utils_get_window_workspace

/**
 * gedit_utils_get_window_workspace: Get the workspace the window is on
 *
 * This function gets the workspace that the #GtkWindow is visible on,
 * it returns GEDIT_ALL_WORKSPACES if the window is sticky, or if
 * the window manager doesn support this function
 */
guint
gedit_utils_get_window_workspace (GtkWindow *gtkwindow)
{
#ifdef GDK_WINDOWING_X11
	GdkWindow *window;
	GdkDisplay *display;
	Atom type;
	gint format;
	gulong nitems;
	gulong bytes_after;
	guint *workspace;
	gint err, result;
	guint ret = GEDIT_ALL_WORKSPACES;

	g_return_val_if_fail (GTK_IS_WINDOW (gtkwindow), 0);
	g_return_val_if_fail (GTK_WIDGET_REALIZED (GTK_WIDGET (gtkwindow)), 0);

	window = gtk_widget_get_window (GTK_WIDGET (gtkwindow));
	display = gdk_drawable_get_display (window);

	gdk_error_trap_push ();
	result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window),
				     gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_DESKTOP"),
				     0, G_MAXLONG, False, XA_CARDINAL, &type, &format, &nitems,
				     &bytes_after, (gpointer) &workspace);
	err = gdk_error_trap_pop ();

	if (err != Success || result != Success)
		return ret;

	if (type == XA_CARDINAL && format == 32 && nitems > 0)
		ret = workspace[0];

	XFree (workspace);
	return ret;
#else
	/* FIXME: on mac etc proably there are native APIs
	 * to get the current workspace etc */
	return 0;
#endif
}
开发者ID:kaushikmit,项目名称:gedit,代码行数:48,代码来源:gedit-utils.c


示例20: gtk_test_create_widget

/**
 * gtk_test_create_widget:
 * @widget_type: a valid widget type.
 * @first_property_name: (allow-none): Name of first property to set or %NULL
 * @...: value to set the first property to, followed by more
 *    name-value pairs, terminated by %NULL
 *
 * This function wraps g_object_new() for widget types.
 * It'll automatically show all created non window widgets, also
 * g_object_ref_sink() them (to keep them alive across a running test)
 * and set them up for destruction during the next test teardown phase.
 *
 * Returns: (transfer none): a newly created widget.
 *
 * Since: 2.14
 */
GtkWidget*
gtk_test_create_widget (GType        widget_type,
                        const gchar *first_property_name,
                        ...)
{
    GtkWidget *widget;
    va_list var_args;
    g_return_val_if_fail (g_type_is_a (widget_type, GTK_TYPE_WIDGET), NULL);
    va_start (var_args, first_property_name);
    widget = (GtkWidget*) g_object_new_valist (widget_type, first_property_name, var_args);
    va_end (var_args);
    if (widget)
    {
        if (!GTK_IS_WINDOW (widget))
            gtk_widget_show (widget);
        g_object_ref_sink (widget);
        g_test_queue_unref (widget);
        g_test_queue_destroy ((GDestroyNotify) gtk_widget_destroy, widget);
    }
    return widget;
}
开发者ID:jdapena,项目名称:gtk,代码行数:37,代码来源:gtktestutils.c



注:本文中的GTK_IS_WINDOW函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GTK_LABEL函数代码示例发布时间:2022-05-30
下一篇:
C++ GTK_IS_WIDGET函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap