当前位置: 首页>>代码示例>>C++>>正文


C++ GDK_THREADS_ENTER函数代码示例

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


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

示例1: close_fftscope_window

static gboolean
close_fftscope_window(GtkWidget * widget, GdkEvent * event, gpointer data)
{
	GDK_THREADS_LEAVE();
	stop_fftscope();
	GDK_THREADS_ENTER();

	return TRUE;
}
开发者ID:RafaelRMachado,项目名称:alsaplayer,代码行数:9,代码来源:fftscope.c

示例2: nsp_app_feeds_search

static void 
nsp_app_feeds_search(void* user_data)
{
	NspApp *app = nsp_app_get();
	NspFeed *feed = nsp_feed_new();
	GtkTreeIter iter;
	GRegex *regex;
	char *new_feed_title = "Search results";
	char *search_exp;
	char *tmp;
	
	feed->title = malloc(sizeof(char)*(strlen(new_feed_title) + 1));
	memcpy(feed->title, new_feed_title, sizeof(char)*(strlen(new_feed_title)+1));
	
	/* Build search term and load results */
	regex = g_regex_new ("(%|_)", 0, 0, NULL);
	tmp = g_regex_replace(regex, (char*)user_data, -1, 0, "\\\\\\0", 0, NULL);
	g_regex_unref(regex);
	
	regex = g_regex_new ("[ \t]+", 0, 0, NULL);
	search_exp = g_regex_replace(regex, tmp, -1, 0, "%", 0, NULL);
	g_regex_unref(regex);
	g_free(tmp);
	
	feed->items = nsp_feed_items_search(search_exp);
	
	/* Update front-end */
	GDK_THREADS_ENTER();
	nsp_feed_update_model(feed);
	gtk_tree_view_set_model(GTK_TREE_VIEW(app->window->feed_item_list), nsp_feed_get_items_model(feed));
	GDK_THREADS_LEAVE();
	
	
	GDK_THREADS_ENTER();
	iter = nsp_feed_list_add(app->window->feed_list, feed, true);
	gtk_tree_store_set (GTK_TREE_STORE(app->window->feed_list->list_model), &iter,
					LIST_COL_ICON, app->window->feed_list->icon_search,
					-1);
	
	app->feeds = g_list_append(app->feeds, feed);
	
	gtk_tree_view_set_cursor(GTK_TREE_VIEW(app->window->feed_list->list_view), gtk_tree_model_get_path(app->window->feed_list->list_model, &iter), NULL, FALSE);
	GDK_THREADS_LEAVE();
}
开发者ID:Michael-Z,项目名称:Nowspide,代码行数:44,代码来源:nsp-app.c

示例3: on_stop_search

static void on_stop_search( GtkWidget* btn, FindFile* data )
{
    if( data->task && ! vfs_async_task_is_finished( data->task ) )
    {
        // see note in vfs-async-task.c: vfs_async_task_real_cancel()
        GDK_THREADS_LEAVE(); 
        vfs_async_task_cancel( data->task );
        GDK_THREADS_ENTER();
    }
}
开发者ID:alfbar0,项目名称:spacefm,代码行数:10,代码来源:find-files.c

示例4: brasero_gio_operation_wait_for_operation_end

static gboolean
brasero_gio_operation_wait_for_operation_end (BraseroGioOperation *operation,
					      GError **error)
{
	BRASERO_MEDIA_LOG ("Waiting for end of async operation");

	g_object_ref (operation->cancel);
	g_cancellable_reset (operation->cancel);
	g_signal_connect (operation->cancel,
			  "cancelled",
			  G_CALLBACK (brasero_gio_operation_cancelled),
			  operation);

	/* put a timeout (30 sec) */
	operation->timeout_id = g_timeout_add_seconds (20,
						       brasero_gio_operation_timeout,
						       operation);

	operation->loop = g_main_loop_new (NULL, FALSE);

	GDK_THREADS_LEAVE ();
	g_main_loop_run (operation->loop);
	GDK_THREADS_ENTER ();

	g_main_loop_unref (operation->loop);
	operation->loop = NULL;

	if (operation->timeout_id) {
		g_source_remove (operation->timeout_id);
		operation->timeout_id = 0;
	}

	if (operation->error) {
		BRASERO_MEDIA_LOG ("Medium operation finished with an error %s",
				   operation->error->message);

		if (operation->error->code == G_IO_ERROR_FAILED_HANDLED) {
			BRASERO_MEDIA_LOG ("Error already handled and displayed by GIO");

			/* means we shouldn't display any error message since 
			 * that was already done */
			g_error_free (operation->error);
			operation->error = NULL;
		}
		else if (error && (*error) == NULL)
			g_propagate_error (error, operation->error);
		else
			g_error_free (operation->error);

		operation->error = NULL;
	}

	g_object_unref (operation->cancel);
	return operation->result;
}
开发者ID:Fedosiy,项目名称:brasero,代码行数:55,代码来源:brasero-gio-operation.c

示例5: process_found_files

static void process_found_files( FindFile* data, GQueue* queue, const char* path )
{
    char *name;
    gsize len, term;
    GtkTreeIter it;
    VFSFileInfo* fi;
    GdkPixbuf* icon;
    FoundFile* ff;

    if( path )
    {
        name = g_filename_display_basename( path );
        fi = vfs_file_info_new();
        if( vfs_file_info_get( fi, path, name ) )
        {
            ff = g_slice_new0( FoundFile );
            ff->fi = fi;
            ff->dir_path = g_path_get_dirname( path );
            g_queue_push_tail( queue, ff );
        }
        else
        {
            vfs_file_info_unref( fi );
        }
        g_free( name );

        /* we queue the found files, and not add them to the tree view direclty.
         * when we queued more than 10 files, we add them at once. I think
         * this can prevent locking gtk+ too frequently and improve responsiveness.
         * FIXME: This could blocked the last queued files and delay their display
         * to the end of the whole search. A better method is needed.
         */
//MOD disabled this - causes last queued files to not display
//        if( g_queue_get_length( queue ) < 10 )
//            return;
    }

    while( ff = (FoundFile*)g_queue_pop_head(queue) )
    {
        GDK_THREADS_ENTER();
        gtk_list_store_append( data->result_list, &it );
        icon = vfs_file_info_get_small_icon( ff->fi );
        gtk_list_store_set( data->result_list, &it,
                                    COL_ICON, icon,
                                    COL_NAME, vfs_file_info_get_disp_name(ff->fi),
                                    COL_DIR, ff->dir_path, /* FIXME: non-UTF8? */
                                    COL_TYPE, vfs_file_info_get_mime_type_desc( ff->fi ),
                                    COL_SIZE, vfs_file_info_get_disp_size( ff->fi ),
                                    COL_MTIME, vfs_file_info_get_disp_mtime( ff->fi ),
                                    COL_INFO, ff->fi, -1 );
        g_object_unref( icon );
        GDK_THREADS_LEAVE();
        g_slice_free( FoundFile, ff );
    }
}
开发者ID:alfbar0,项目名称:spacefm,代码行数:55,代码来源:find-files.c

示例6: nsp_app_feed_add

static void
nsp_app_feed_add (void* user_data)
{
	NspApp *app = nsp_app_get();
	char *url = g_strdup((const char*) user_data);
	NspFeed *feed;
	GtkTreeIter iter;
	char *new_feed_title = "New Subscription";
	
	/* Create the new feed, populate it and add it to the list */
	feed = nsp_feed_new();
	feed->url = url;
	feed->title = malloc(sizeof(char)*(strlen(new_feed_title) + 1));
	memcpy(feed->title, new_feed_title, sizeof(char)*(strlen(new_feed_title)+1));
	
	GDK_THREADS_ENTER();
	iter = nsp_feed_list_add(app->window->feed_list, feed, false);
	gtk_tree_store_set (GTK_TREE_STORE(app->window->feed_list->list_model), &iter,
					LIST_COL_ICON, app->window->feed_list->icon_load,
					-1);
	GDK_THREADS_LEAVE();
	
	/* Fetch and save the items */
	if ( nsp_feed_update_items(feed) || nsp_feed_save_to_db(feed) ) {
		nsp_feed_list_remove(app->window->feed_list, feed);
		nsp_feed_free(feed);
		return;
	}
	
	app->feeds = g_list_append(app->feeds, feed);
	GDK_THREADS_ENTER();
	nsp_feed_update_model(feed);
	nsp_feed_update_unread_count(feed);
	nsp_feed_list_update_entry(app->window->feed_list, feed);
	GDK_THREADS_LEAVE();
	
	if ( !nsp_feed_update_icon(feed) ) {
		GDK_THREADS_ENTER();
		nsp_feed_list_update_entry(app->window->feed_list, feed);
		GDK_THREADS_LEAVE();
	}
}
开发者ID:Michael-Z,项目名称:Nowspide,代码行数:42,代码来源:nsp-app.c

示例7: scroll_row_timeout

/* Scroll function taken/adapted from gtktreeview.c */
static gint
scroll_row_timeout (gpointer data)
{
	GtkTreeView *tree_view = data;
	GdkRectangle visible_rect;
	gint y, x;
	gint offset;
	gfloat value;
	GtkAdjustment* vadj;
	RbTreeDndData *priv_data;

	GDK_THREADS_ENTER ();

	priv_data = g_object_get_data (G_OBJECT (tree_view), RB_TREE_DND_STRING);
	g_return_val_if_fail(priv_data != NULL, TRUE);

	gdk_window_get_pointer (gtk_tree_view_get_bin_window (tree_view), &x, &y, NULL);
	gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, x, y, &x, &y);
	gtk_tree_view_convert_bin_window_to_tree_coords (tree_view, x, y, &x, &y);

	gtk_tree_view_get_visible_rect (tree_view, &visible_rect);

	/* see if we are near the edge. */
	if (x < visible_rect.x && x > visible_rect.x + visible_rect.width)
	{
		GDK_THREADS_LEAVE ();
		priv_data->scroll_timeout = 0;
		return FALSE;
	}

	offset = y - (visible_rect.y + 2 * SCROLL_EDGE_SIZE);
	if (offset > 0)
	{
		offset = y - (visible_rect.y + visible_rect.height - 2 * SCROLL_EDGE_SIZE);
		if (offset < 0) 
		{
			GDK_THREADS_LEAVE ();
			priv_data->scroll_timeout = 0;
			return FALSE;
		}
	}

	vadj = gtk_tree_view_get_vadjustment (tree_view);
	value = CLAMP (vadj->value + offset, vadj->lower, vadj->upper - vadj->page_size);
	gtk_adjustment_set_value (vadj, value);

	/* don't remove it if we're on the edge and not scrolling */
	if (ABS (vadj->value - value) > 0.0001)
		remove_select_on_drag_timeout(tree_view);

	GDK_THREADS_LEAVE ();

	return TRUE;
}
开发者ID:paulbellamy,项目名称:Rhythmbox-iPod-Plugin,代码行数:55,代码来源:rb-tree-dnd.c

示例8: gtk_combo_focus_idle

static gint
gtk_combo_focus_idle (GtkCombo * combo)
{
  if (combo)
    {
      GDK_THREADS_ENTER ();
      gtk_widget_grab_focus (combo->entry);
      GDK_THREADS_LEAVE ();
    }
  return FALSE;
}
开发者ID:Onjrew,项目名称:OpenEV,代码行数:11,代码来源:gtkcombo.c

示例9: button_activate_timeout

static gboolean
button_activate_timeout (gpointer data)
{
  GDK_THREADS_ENTER ();
  
  gtk_button_finish_activate (data, TRUE);

  GDK_THREADS_LEAVE ();

  return FALSE;
}
开发者ID:zjx632,项目名称:tinygtk,代码行数:11,代码来源:gtkbutton.c

示例10: interface_gtk_stop

int interface_gtk_stop()
{
	global_update = -1;

	GDK_THREADS_ENTER();

	gdk_flush();
	gtk_exit(0); // This is *NOT* clean :-(
	GDK_THREADS_LEAVE();
	return 1;
}
开发者ID:RafaelRMachado,项目名称:alsaplayer,代码行数:11,代码来源:gtk.cpp

示例11: ensure_dlg

static void ensure_dlg(FmProgressDisplay* data)
{
    if(data->delay_timeout)
    {
        g_source_remove(data->delay_timeout);
        data->delay_timeout = 0;
    }
    GDK_THREADS_ENTER();
    if(!data->dlg)
        _on_show_dlg(data);
    GDK_THREADS_LEAVE();
}
开发者ID:lxde,项目名称:libfm,代码行数:12,代码来源:fm-progress-dlg.c

示例12: xt_event_prepare

static gboolean
xt_event_prepare (GSource*  source_data,
                   gint     *timeout)
{   
  int mask;

  GDK_THREADS_ENTER();
  mask = XPending(xtdisplay);
  GDK_THREADS_LEAVE();

  return (gboolean)mask;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:12,代码来源:gtk2xtbin.c

示例13: populate_files

gboolean populate_files (gpointer data)     //TODO:: show an spinner while loading
{
  FilebrowserBackend *filebackend= FILEBROWSER_BACKEND(data);
  FilebrowserBackendDetails *directory = FILEBROWSER_BACKEND_GET_PRIVATE(filebackend);
  GDK_THREADS_ENTER();
  if (g_cancellable_is_cancelled (directory->cancellable)){
  GDK_THREADS_LEAVE();
  return FALSE; /* remove source */
  }
  GError *error=NULL;
  GFileInfo *info = g_file_enumerator_next_file (directory->enumerator, directory->cancellable, &error);
  if (info){
	  const gchar *mime= g_file_info_get_content_type (info);
	  if (!g_file_info_get_is_hidden (info)  && !g_file_info_get_is_backup (info)){
	    if (MIME_ISDIR(mime)){
		//if has dot in name pos 0 don't process
		const gchar *folder=g_file_info_get_display_name(info);
		if(folder[0]!='.'){
		  FOLDERFILE *current;
		  current=new_folderfile();
		  current->mime=g_strdup(mime);
      GIcon *icon =g_file_info_get_icon(info); 
      current->icon= g_icon_to_string (icon);
		  current->display_name=g_strdup(folder);
		  /* add to list */
		 directory->filesinfolder = g_slist_append(directory->filesinfolder, current);
		  }
	  } else {
	    if (IS_TEXT(mime) && !IS_APPLICATION(mime)){
	      //files
	      FOLDERFILE *current;
	      current=new_folderfile();
	      current->mime=g_strdup(mime);
	      GIcon *icon =g_file_info_get_icon(info); 
	      current->icon= g_icon_to_string (icon);
	      current->display_name=g_strdup(g_file_info_get_display_name(info));
	      /* add to list */
	      directory->filesinfolder = g_slist_append(directory->filesinfolder, current);
	      }
	    }
	  }	
	g_object_unref(info);
   } else {
   	if (error){
   		g_print(_("Error::%s"),error->message);
   		g_error_free (error);
   	}
	GDK_THREADS_LEAVE();
	return FALSE; /* remove source */
   }
    GDK_THREADS_LEAVE();
    return TRUE;
}
开发者ID:anoopjohn,项目名称:gphpedit,代码行数:53,代码来源:filebrowser_backend.c

示例14: remove_message_timeout

static gint
remove_message_timeout (MessageInfo * mi)
{
  GDK_THREADS_ENTER ();

  mate_appbar_refresh(MATE_APPBAR(mi->app->statusbar));
  g_signal_handler_disconnect(mi->app, mi->handlerid);
  g_free ( mi );

  GDK_THREADS_LEAVE ();

  return FALSE; /* removes the timeout */
}
开发者ID:fatman2021,项目名称:libmateui,代码行数:13,代码来源:mate-app-util.c

示例15: animation_timeout

static gboolean
animation_timeout (gpointer data)
{
    gboolean retval;

    GDK_THREADS_ENTER ();

    retval = do_animation (data);

    GDK_THREADS_LEAVE ();

    return retval;
}
开发者ID:ammonkey,项目名称:marlin,代码行数:13,代码来源:gossip-cell-renderer-expander.c


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