Exemplo n.º 1
0
void idle_test()
{
	int user_data = 0;
	gboolean retVal;
	GSource *s = g_idle_source_new();

	idle_loop = g_main_loop_new(NULL, FALSE);
	g_source_attach(s,context);

	g_idle_add((GSourceFunc)function,&user_data);

	retVal = g_idle_remove_by_data(&user_data);

	//checks g_idle_remove_by_data
	g_assert(retVal == TRUE);
	retVal = FALSE;

	g_idle_add((GSourceFunc)function,&user_data);

	retVal = g_source_remove_by_user_data(&user_data);

	//checks g_source_remove_by_user_data
	g_assert(retVal == TRUE);

	g_idle_add((GSourceFunc)function,&user_data);

	g_main_loop_run(idle_loop);

	g_main_loop_unref(idle_loop);

	//checks whether the function was run or not
	g_assert(user_data == 1);
}
Exemplo n.º 2
0
__EXPORT void lttvwindow_events_request_remove_all(Tab       *tab,
                                          gconstpointer   viewer)
{
  GSList *element = tab->events_requests;
  
  while((element = 
            g_slist_find_custom(element, viewer,
                                (GCompareFunc)find_viewer))
              != NULL) {
    EventsRequest *events_request = (EventsRequest *)element->data;
    // Modified so a viewer being destroyed won't have its after_request
    // called. Not so important anyway. Note that a viewer that call this
    // remove_all function will not get its after_request called.
    //if(events_request->servicing == TRUE) {
    //  lttv_hooks_call(events_request->after_request, NULL);
    //}
    events_request_free(events_request);
    //g_free(events_request);
    tab->events_requests = g_slist_remove_link(tab->events_requests, element);
    element = g_slist_next(element);
    if(element == NULL) break;   /* end of list */
  }
  if(g_slist_length(tab->events_requests) == 0) {
    tab->events_request_pending = FALSE;
    g_idle_remove_by_data(tab);
  }

}
Exemplo n.º 3
0
/**
 * Whenever the current page is changed, if an invoice page is
 * the current page, set focus on the sheet or notes field.
 */
static void
gnc_plugin_page_invoice_main_window_page_changed (GncMainWindow *window,
        GncPluginPage *plugin_page, gpointer user_data)
{
    // We continue only if the plugin_page is a valid
    if (!plugin_page || !GNC_IS_PLUGIN_PAGE(plugin_page))
        return;

    if (gnc_main_window_get_current_page (window) == plugin_page)
    {
        GncPluginPageInvoice *page;
        GncPluginPageInvoicePrivate *priv;

        if (!GNC_IS_PLUGIN_PAGE_INVOICE(plugin_page))
            return;

        page = GNC_PLUGIN_PAGE_INVOICE(plugin_page);
        priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);

        // The page changed signal is emitted multiple times so we need
        // to use an idle_add to change the focus to the sheet
        g_idle_remove_by_data (priv->iw);
        g_idle_add ((GSourceFunc)gnc_plugin_page_invoice_focus, priv->iw);
    }
}
Exemplo n.º 4
0
static void
dispose (GObject *gobject)
{
  while (g_idle_remove_by_data (gobject)) ;

  G_OBJECT_CLASS (gegl_cache_parent_class)->dispose (gobject);
}
Exemplo n.º 5
0
static void bar_pane_gps_update(PaneGPSData *pgd)
{
	GList *list;
	GList *work;

	/* The widget does not have a parent during bar_pane_gps_new, so calling gtk_widget_show_all there gives a
	 * "Gtk-CRITICAL **: gtk_widget_realize: assertion `GTK_WIDGET_ANCHORED (widget) || GTK_IS_INVISIBLE (widget)' failed"
	 * error. gtk_widget_show_all can be given after it has been added to the bar.
	 */
	if (gtk_widget_get_parent(pgd->widget) != NULL)
		gtk_widget_show_all(pgd->widget);

	/* If a create-marker background process is running, kill it
	 * and start again
	 */
	if (pgd->create_markers_id != 0)
		{
		if (g_idle_remove_by_data(pgd))
			{
			pgd->create_markers_id = 0;
			}
		else
			{
			return;
			}		
		}

	/* Delete any markers currently displayed
	 */
	work = clutter_container_get_children(CLUTTER_CONTAINER(pgd->icon_layer));
	while (work)
		{
		clutter_container_remove(CLUTTER_CONTAINER(pgd->icon_layer), work->data, NULL);
		work = work->next;
		}
	g_list_free(work);

	if (!pgd->enable_markers_checked)
		{
		return;
		}

	/* For each selected photo that has GPS data, create a marker containing
	 * a single, small text character the same colour as the marker background.
	 * Use a background process in case the user selects a large number of files.
	 */
	list = layout_selection_list(pgd->pane.lw);
	list = file_data_process_groups_in_selection(list, FALSE, NULL);

	if (list != NULL)
		{
		pgd->selection_list = g_list_copy(list);
		pgd->marker_list = g_ptr_array_new();
		pgd->selection_count = g_list_length(pgd->selection_list);
		pgd->create_markers_id = g_idle_add(bar_pane_gps_create_markers_cb, pgd);
		}

	g_list_free(list);
	g_list_free(work);
}
Exemplo n.º 6
0
static void
dispose (GObject *gobject)
{
    GeglCache *self = GEGL_CACHE (gobject);

    while (g_idle_remove_by_data (gobject)) ;

    /* Check with GEGL_IS_NODE since sometimes the node is destroyed
     * before we get here
     */
    if (GEGL_IS_NODE (self->node))
    {
        gint handler = g_signal_handler_find (self->node, G_SIGNAL_MATCH_DATA,
                                              g_signal_lookup ("invalidated",
                                                      GEGL_TYPE_NODE),
                                              0, NULL, NULL, self);
        if (handler)
        {
            g_signal_handler_disconnect (self->node, handler);
        }
        self->node = NULL;
    }

    G_OBJECT_CLASS (gegl_cache_parent_class)->dispose (gobject);
}
Exemplo n.º 7
0
void clean_data(int signum)
{
	//message_box(NULL,strerror(errno));
	/*信息处理函数*/
	sig_data->off=0;
	while(waitpid(-1,NULL,WNOHANG)!=-1);
	//pthread_cancel(sig_data->thread);
	g_idle_remove_by_data(sig_data);
}
Exemplo n.º 8
0
int Disconnect(mcpanel* panel)
{
	run_eeg = 0;

	g_idle_remove_by_data(panel);
	free(geeg);
	free(gexg);
	free(gtri);

	return 0;
}
Exemplo n.º 9
0
void _chisel_native_application_set_use_idle_task( int status ) {
    static gboolean currentStatus = FALSE;

    if ( status && !currentStatus ) {
        g_idle_add( _chisel_native_idle_task, _chisel_native_idle_task );
    } else if ( !status && currentStatus ) {
        g_idle_remove_by_data( _chisel_native_idle_task );
    }

    currentStatus = status;
}
Exemplo n.º 10
0
static void rc_remove_pending_updates(RendererClutter *rc)
{
	if (rc->idle_update) g_idle_remove_by_data(rc);
	rc->idle_update = 0;
	while (rc->pending_updates)
		{
		RendererClutterAreaParam *par = rc->pending_updates->data;
		rc->pending_updates = g_list_remove(rc->pending_updates, par);
		g_free(par);
		}
}
Exemplo n.º 11
0
static void
anjuta_async_command_finalize (GObject *object)
{
	AnjutaAsyncCommand *self;
	
	self = ANJUTA_ASYNC_COMMAND (object);
	
	g_mutex_clear (&self->priv->mutex);
	g_idle_remove_by_data (self);
	
	g_free (self->priv);

	G_OBJECT_CLASS (anjuta_async_command_parent_class)->finalize (object);
}
Exemplo n.º 12
0
static void 
source_fd_untrap (Source *source)
{
  SourceFD *sfd = (SourceFD *) source;
  if (sfd->is_pollable)
    {
      if (sfd->source)
        {
          g_source_destroy ((GSource *) sfd->source);
          sfd->source = NULL;
        }
    }
  else
    g_idle_remove_by_data (source);
}
Exemplo n.º 13
0
/*!
 * Stop this idle from running
 */
void UT_UnixIdle::stop ()
{
//
// Sevior: Once again we have to ignore this if the idle is already stopped.
//    UT_ASSERT(m_id > 0);
	if(m_id > 0)
	{
#ifndef TOOLKIT_COCOA
		gboolean b = g_idle_remove_by_data(this);
		UT_UNUSED(b);
		UT_ASSERT(TRUE == b);
#else
		UT_ASSERT (UT_NOT_IMPLEMENTED);
#endif
	}
	m_id = -1;
}
Exemplo n.º 14
0
static gboolean stop_data(GstElement *source)
    {

    if (gst_element_is_locked_state(source) == FALSE)
	{
	if (gst_element_set_locked_state(source, TRUE) == TRUE)
	    {
	    std::clog << "##### LOCK OK" << std::endl;
	    std::clog << "##### LOCK  NOW" << std::endl;
	    GstState rtspstate;
	    gst_element_get_state(source, &rtspstate, NULL, GST_CLOCK_TIME_NONE);
	    switch (rtspstate)
		{
	    case GST_STATE_PLAYING:
		gst_element_set_state(source, GST_STATE_PAUSED);

		gst_element_set_locked_state(source, FALSE);
		break;
	    case GST_STATE_PAUSED:
		gst_element_set_state(source, GST_STATE_READY);

		gst_element_set_locked_state(source, FALSE);
		break;
	    case GST_STATE_READY:
		gst_element_set_state(source, GST_STATE_NULL);

		gst_element_set_locked_state(source, FALSE);
		break;
	    case GST_STATE_NULL:
		gst_object_unref(GST_OBJECT(source));
		g_idle_remove_by_data(source);
		break;

		}

	    std::clog << "########## State: " << gst_element_state_get_name(
		    rtspstate) << std::endl;
	    //    gst_object_unref(GST_OBJECT(source));
	    }
	}

    }
Exemplo n.º 15
0
static void
gnc_plugin_page_invoice_destroy_widget (GncPluginPage *plugin_page)
{
    GncPluginPageInvoice *page;
    GncPluginPageInvoicePrivate *priv;

    ENTER("page %p", plugin_page);
    page = GNC_PLUGIN_PAGE_INVOICE (plugin_page);
    priv = GNC_PLUGIN_PAGE_INVOICE_GET_PRIVATE(page);

    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
                                 GNC_PREF_SUMMARYBAR_POSITION_TOP,
                                 gnc_plugin_page_invoice_summarybar_position_changed,
                                 page);
    gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL,
                                 GNC_PREF_SUMMARYBAR_POSITION_BOTTOM,
                                 gnc_plugin_page_invoice_summarybar_position_changed,
                                 page);

    // Remove the page focus idle function if present
    g_idle_remove_by_data (priv->iw);

    if (priv->widget == NULL)
    {
        LEAVE("");
        return;
    }

    if (priv->component_manager_id)
    {
        gnc_unregister_gui_component(priv->component_manager_id);
        priv->component_manager_id = 0;
    }

    gtk_widget_hide(priv->widget);
    gnc_invoice_window_destroy_cb(priv->widget, priv->iw);
    priv->widget = NULL;
    LEAVE("");
}
Exemplo n.º 16
0
void disconnect_goagent(GtkWidget *widget,DATA *data)
{
	GtkTextBuffer *buffer=gtk_text_view_get_buffer(GTK_TEXT_VIEW(data->text));

	if(!data->off)
	{
		message_box(widget,_("No Connected Now!"));
		return;
	}

	/*断开连接设置off开关并杀死所调用的进程*/
	data->off=0;
	kill(data->pid,SIGKILL);
	//while(waitpid(-1,NULL,WNOHANG)!=-1);
	g_idle_remove_by_data(data);

	/*while(gtk_events_pending())
		gtk_main_iteration();*/

	/*清除主界面日志框内容*/
	gtk_text_buffer_set_text(buffer,"",0);
}
Exemplo n.º 17
0
GTKVideo::~GTKVideo() {
  gst_pipeline_.reset();
  g_idle_remove_by_data(this);
  if (nullptr != title_)
    g_free(title_);
  // destroy child widgets too
  if (main_window_ != nullptr && GTK_IS_WIDGET(main_window_)) {
    std::unique_lock<std::mutex> lock(window_destruction_mutex_);
    // g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
    //     destroy_window,
    //     this,
    //     window_destroyed);
    gtk_idle_add(destroy_window, this);
    window_destruction_cond_.wait(lock);
  }
  if (blank_cursor_ != nullptr)
    gdk_cursor_destroy(blank_cursor_);
  // instances_counter_ --;
  // if (instances_counter_ == 0)
  //   {
  // g_debug ("GTKVideo::~GTKVideo invoking gtk_main_quit");
  // gtk_main_quit ();
  //   }
}
Exemplo n.º 18
0
IRC_Client_GUI_MessageHandler::~IRC_Client_GUI_MessageHandler ()
{
  RPG_TRACE (ACE_TEXT ("IRC_Client_GUI_MessageHandler::~IRC_Client_GUI_MessageHandler"));

  // sanity check(s)
  ACE_ASSERT (CBData_.GTKState);

  ACE_Guard<ACE_Thread_Mutex> aGuard (CBData_.GTKState->lock);

  // remove queued events
  while (g_idle_remove_by_data (this));
  if (eventSourceID_)
  {
    Common_UI_GTKEventSourceIdsIterator_t iterator =
        CBData_.GTKState->eventSourceIds.begin();
    while (iterator != CBData_.GTKState->eventSourceIds.end())
    {
      if (*iterator == eventSourceID_)
      {
        iterator = CBData_.GTKState->eventSourceIds.erase(iterator);
        continue;
      } // end IF

      iterator++;
    }
    if (iterator != CBData_.GTKState->eventSourceIds.end ())
      CBData_.GTKState->eventSourceIds.erase (iterator);
  } // end IF

  // *NOTE*: the server log handler MUST NOT do this...
  if (parent_)
  {
    // remove server page from parent notebook
    Common_UI_GTKBuildersIterator_t iterator =
        CBData_.GTKState->builders.find (builderLabel_);
    // sanity check(s)
    if (iterator == CBData_.GTKState->builders.end ())
    {
      ACE_DEBUG ((LM_ERROR,
                  ACE_TEXT ("handler (was: \"%s\") builder not found, returning\n"),
                  ACE_TEXT (builderLabel_.c_str ())));
      return;
    } // end IF

    GtkVBox* vbox_p =
      GTK_VBOX (gtk_builder_get_object ((*iterator).second.second,
                                        ACE_TEXT_ALWAYS_CHAR ("channel_tab_vbox")));
    ACE_ASSERT (vbox_p);
    guint page_num = gtk_notebook_page_num (parent_,
                                            GTK_WIDGET (vbox_p));

    // flip away from "this" page ?
    if (gtk_notebook_get_current_page (parent_) == static_cast<gint> (page_num))
      gtk_notebook_prev_page (parent_);

    // remove channel page from channel tabs notebook
    gtk_notebook_remove_page (parent_,
                              page_num);

    g_object_unref (G_OBJECT ((*iterator).second.second));
    CBData_.GTKState->builders.erase (iterator);
  } // end IF
}
Exemplo n.º 19
0
static void
repair_dialog_update_file_list_model(GtkDialog* dialog, gboolean async)
{
    GtkTreeStore* store;
    GtkTreeView* treeview;
    GSList* files;
    gboolean include_subdir;
    GtkComboBox* combobox;
    UpdateContext* context;
    gboolean success_all = TRUE;

    store = repair_dialog_get_file_list_model(dialog);
    files = repair_dialog_get_file_list(dialog);
    treeview = repair_dialog_get_file_list_view(dialog);
    include_subdir = repair_dialog_get_include_subdir_flag(dialog);

    combobox = repair_dialog_get_encoding_combo_box(dialog);
    gtk_widget_set_sensitive(GTK_WIDGET(combobox), FALSE);

    gtk_tree_store_clear(store);

    if (async) {
	context = repair_dialog_get_update_context(dialog);
	if (context != NULL) {
	    g_idle_remove_by_data(dialog);
	    update_context_free(context);
	}

	context = update_context_new();
	context->dialog = dialog;
	context->treeview = treeview;
	context->store = store;
	context->file_stack = g_slist_copy(files);
	context->encoding = repair_dialog_get_current_encoding(dialog);
	context->include_subdir = include_subdir;

	g_slist_foreach(context->file_stack, (GFunc)g_object_ref, NULL);

	repair_dialog_set_update_context(dialog, context);

	g_idle_add((GSourceFunc)repair_dialog_on_idle_update, dialog);
    } else {
	char* encoding = repair_dialog_get_current_encoding(dialog);

	while (files != NULL) {
	    GtkTreeIter iter;
	    char* name;
	    char* display_name;
	    char* new_name;
	    GFile* file;

	    file = files->data;
	    name = g_file_get_basename(file);
	    display_name = get_display_name(name);
	    new_name = get_new_name(name, encoding);

	    file_list_model_append(store, &iter, NULL,
		    file, name, display_name, new_name);
	    if (new_name == NULL)
		success_all = FALSE;
	    
	    if (include_subdir) {
		GFileType file_type;
		file_type = g_file_query_file_type(file,
			G_FILE_QUERY_INFO_NONE, NULL);
		if (file_type == G_FILE_TYPE_DIRECTORY) {
		    gboolean res;
		    res = append_dir(store, &iter, file, encoding);
		    if (!res)
			success_all = FALSE;
		}
	    }

	    g_free(name);
	    g_free(display_name);
	    g_free(new_name);

	    files = g_slist_next(files);
	}

	gtk_tree_view_expand_all(treeview);
	g_free(encoding);

	repair_dialog_on_update_end(dialog, success_all);
    }
}
Exemplo n.º 20
0
/*主界面进入点*/
int main(int argc,char **argv)
{
	GtkWidget *win;
	GtkWidget *menu;
	GtkWidget *menu_bar;
	GtkWidget *vbox;
	GtkWidget *hbox;
	GtkWidget *text;
	GtkWidget *scrolled;
	GtkWidget *open;
	GtkWidget *close;
	GtkWidget *clean;
	GtkTextBuffer *buffer;
	GtkAccelGroup *accel_group;
	PangoFontDescription *font_name;
	DATA data;
	CONFDATA conf;
	ABOUT about_data;
	//HELP help_data;
	struct sigaction act,old;

	setpgrp();

	init_with_conf(&conf);
	init_about_data(&about_data);
	//init_help_data(&help_data);

	data.buf=g_string_new(NULL);
	data.python_path=conf.python_path;
	data.proxy_py_path=conf.proxy_py_path;
	setlocale(LC_ALL,"");

	/*设置语言环境*/
	if(conf.language_env == NULL)
	{
		setlocale(LC_CTYPE,"zh_CN.UTF-8");
		setenv("LANG","zh_CN.UTF-8",1);
	}
	else
	{
		setlocale(LC_CTYPE,conf.language_env);
		setenv("LANG",conf.language_env,1);
	}
	
	if(conf.gtk_goagent_path!=NULL)
		chdir(conf.gtk_goagent_path);

	/*是否自动更新
	 * 如果是则在后台运行版更新进程
	 */
	if(strcmp(conf.goagent_auto_upgrade,"true")==0)
		auto_upgrade_goagent(GOAGENT_URL,&conf);

	/*国际化*/
	bindtextdomain("gtk_goagent","./locale/");
	textdomain("gtk_goagent");

	act.sa_flags=0;
	act.sa_handler=clean_data;
	/*设置自定义信号处理
	 * 用于在启动GoAgent失败时清理数据
	 */
	sigaction(SIGUSR1,&act,&old);

	gtk_init(&argc,&argv);

	win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_position(GTK_WINDOW(win),GTK_WIN_POS_CENTER);
	gtk_window_set_title(GTK_WINDOW(win),"Gtk GoAgent");
	gtk_window_set_icon_from_file(GTK_WINDOW(win),"img/64x64/gtk_goagent.png",NULL);

	create_tray(win);
	//create_pre_ui(&pre,&conf);

	vbox=gtk_vbox_new(FALSE,0);
	accel_group=gtk_accel_group_new();
	gtk_window_add_accel_group(GTK_WINDOW(win),accel_group);
	gtk_container_add(GTK_CONTAINER(win),vbox);

	text=gtk_text_view_new();

	/*设置日志显示框字体*/
	if(conf.font!=NULL)
	{
		font_name=pango_font_description_from_string(conf.font);
		gtk_widget_modify_font(text,font_name);
	}

	buffer=gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
	/*创建红色黑色和黄色标记
	 * 正常日志黑色输出
	 * 绿色用于警告
	 * 红色用于错误
	 * 黄色用于调试
	 */
	gtk_text_buffer_create_tag(buffer,"green_fg",
			"foreground","green",NULL);
	gtk_text_buffer_create_tag(buffer,"red_fg","foreground",
			"red",NULL);
	gtk_text_buffer_create_tag(buffer,"black_fg","foreground",
			"black",NULL);
	gtk_text_buffer_create_tag(buffer,"yellow_fg",
			"foreground","yellow",NULL);

	data.text=text;
	data.off=0;

	menu_bar=gtk_menu_bar_new();
	gtk_box_pack_start(GTK_BOX(vbox),menu_bar,FALSE,FALSE,0);
	/*创建菜单*/
	menu=create_menu(menu_bar,_("_File"));
	create_menu_with_image(menu,GTK_STOCK_OPEN,accel_group,connect_goagent,&data);
	create_menu_with_image(menu,GTK_STOCK_CLOSE,accel_group,disconnect_goagent,&data);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu),gtk_separator_menu_item_new());
	create_menu_with_image(menu,GTK_STOCK_QUIT,accel_group,really_quit,&data);

	menu=create_menu(menu_bar,_("_Edit"));
	create_menu_with_image(menu,GTK_STOCK_PREFERENCES,accel_group,preferences,NULL);
	create_menu_with_image(menu,_("Up_load"),accel_group,upload,&conf);

	menu=create_menu(menu_bar,_("_Help"));
	create_menu_with_image(menu,GTK_STOCK_HELP,accel_group,help,NULL);
	create_menu_with_image(menu,GTK_STOCK_ABOUT,accel_group,about,&about_data);
	gtk_menu_shell_append(GTK_MENU_SHELL(menu),gtk_separator_menu_item_new());
	create_menu_with_image(menu,_("Upgrade GoAg_ent"),accel_group,upgrade_goagent,conf.proxy_py_path);
	//create_menu_with_image(menu,_("Upgrade _Gtk GoAGent"),accel_group,upgrade_gtk_goagent,NULL);

	gtk_widget_set_size_request(text,0x300,0x180);
	/*设置显示构件不可编辑和自动换行*/
	gtk_text_view_set_editable(GTK_TEXT_VIEW(text),FALSE);
	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text),GTK_WRAP_CHAR);
	/*创建滚动条并设置自动更新*/
	scrolled=gtk_scrolled_window_new(NULL,NULL);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
	gtk_container_add(GTK_CONTAINER(scrolled),text);
	gtk_box_pack_start(GTK_BOX(vbox),scrolled,FALSE,FALSE,0);

	gtk_box_pack_start(GTK_BOX(vbox),gtk_separator_menu_item_new(),FALSE,FALSE,5);
	show_time(vbox);
	gtk_box_pack_start(GTK_BOX(vbox),gtk_separator_menu_item_new(),FALSE,FALSE,5);

	hbox=gtk_hbox_new(FALSE,0);
	gtk_box_pack_start(GTK_BOX(vbox),hbox,FALSE,FALSE,5);
	
	open=gtk_button_new_with_label(_("Connect"));
	gtk_box_pack_start(GTK_BOX(hbox),open,FALSE,FALSE,30);
	g_signal_connect(G_OBJECT(open),"clicked",G_CALLBACK(connect_goagent),&data);
	clean=gtk_button_new_with_label(_("Clean"));
	gtk_box_pack_start(GTK_BOX(hbox),clean,TRUE,TRUE,100);
	g_signal_connect(G_OBJECT(clean),"clicked",G_CALLBACK(clean_buffer),&data);
	close=gtk_button_new_with_label(_("Disconnect"));
	gtk_box_pack_end(GTK_BOX(hbox),close,FALSE,FALSE,30);
	g_signal_connect(G_OBJECT(close),"clicked",G_CALLBACK(disconnect_goagent),&data);

	g_signal_connect(G_OBJECT(win),"delete_event",G_CALLBACK(really_quit),NULL);

	gtk_widget_show_all(win);

	gtk_main();

	//setpgrp();
	g_idle_remove_by_data(&data);
	g_string_free(data.buf,TRUE);

	kill(0,SIGKILL);
	//killpg(getpgrp(),SIGKILL);
	while(waitpid(-1,NULL,WNOHANG)!=-1);
	//g_idle_remove_by_data(&data);

	return 0;
}