Exemplo n.º 1
0
/*
 * Standard Gtk+ function
 */
static void Dw_gtk_viewport_destroy (GtkObject *object)
{
   GtkDwViewport *viewport;

   viewport = GTK_DW_VIEWPORT (object);

   if (viewport->back_pixmap)
      gdk_pixmap_unref (viewport->back_pixmap);
   if (viewport->child)
      gtk_object_destroy (GTK_OBJECT (viewport->child));
   if (viewport->draw_resize_idle_id != 0)
      gtk_idle_remove (viewport->draw_resize_idle_id);
   if (viewport->anchor_idle_id != 0)
      gtk_idle_remove (viewport->anchor_idle_id);
   g_free (viewport->anchor);

   g_hash_table_foreach_remove (viewport->anchors_table,
                                Dw_gtk_viewport_destroy_anchor, NULL);
   g_hash_table_destroy (viewport->anchors_table);

   g_free (viewport->draw_areas);

   a_Findtext_state_destroy (viewport->findtext_state);
   a_Selection_free (viewport->selection);

   GTK_OBJECT_CLASS(parent_class)->destroy (object);
}
Exemplo n.º 2
0
int main (int argc, char *argv[])
{
    gchar *path;
    guint hndl_id0, hndl_id1;
//    char *lang;
    int opt;
    int longopt_index;
    setlocale (LC_ALL, "");//lang);
    static struct option long_options[] = {
        {"help", 0, NULL, 'h'},
        {"version", 0, NULL, 'v'},
        {NULL, 0, NULL, 0}
    };

    while ((opt = getopt_long(argc, argv, "h:v", long_options, &longopt_index)) > 0)
    {
        switch (opt)
        {
            case 'v':
                printf ("%s %s\n%s\n", g_ascii_strdown(APPNAME,strlen(APPNAME)),
                        VERSION,
                        "Copyright 2016 Roman Borisov");
                goto cleanup;
                break;
            case 'h':
            default:
                fprintf(stderr, "usage: %s [options]\n", basename(argv[0]));
                fprintf(stderr, "  -h, --help           display this help\n");
                fprintf(stderr, "  -v, --version            version information\n");
                return 1;
        }
    }

    gdk_threads_init ();

    gtk_init (&argc, &argv);
    gtk_app_init();
//    gtk_window_fullscreen(GDK_WINDOW(gtk.main_window));
    gtk_widget_show (gtk.main_window);

    db_init();

    gdk_threads_enter ();
	hndl_id0 = g_idle_add((GtkFunction)mpd_idle, NULL);
    hndl_id1 = g_idle_add((GtkFunction)player_idle, NULL);
    gtk_main ();
    gtk_idle_remove(hndl_id0);
    gtk_idle_remove(hndl_id1);
    gdk_threads_leave ();

    db_close();
cleanup:
    

    return 0;
}
Exemplo n.º 3
0
PRIVATE void clock_handler(AClock *clock, AClockReason reason) {
  Data *data = clock->gen->data;

  switch (reason) {
    case CLOCK_DISABLE:
      if (data->open) {
	gtk_idle_remove(data->idle_tag);
	close_audiofd(data->hwo);
	data->open = FALSE;
      }
      break;

    case CLOCK_ENABLE:
      if (!data->open) {
	data->open = open_audiofd(&data->hwo);
	if (data->open)
	  data->idle_tag = gtk_idle_add(idle_handler, NULL);
      }
      break;

    default:
      g_message("Unreachable code reached (win_output)... reason = %d", reason);
      break;
  }
}
Exemplo n.º 4
0
static VALUE
rg_m_idle_remove(VALUE self, VALUE id)
{
    gtk_idle_remove(NUM2UINT(id));
    G_REMOVE_RELATIVE(self, id__idle_callbacks__, id);
    return Qnil;
}
Exemplo n.º 5
0
static void
tray_clicked_callback (GtkStatusIcon* status, guint button, guint activate_time, cam * cam){
        // FIXME: change to switch
        if (button == 1) {
            if (GTK_WIDGET_VISIBLE
                (glade_xml_get_widget (cam->xml, "main_window"))) {
                cam->hidden = TRUE;
                gtk_idle_remove (cam->idle_id);
                gtk_widget_hide (glade_xml_get_widget
                                 (cam->xml, "main_window"));
            } else {
                cam->idle_id =
                    gtk_idle_add ((GSourceFunc) pt2Function, (gpointer) cam);
                gtk_widget_show (glade_xml_get_widget
                                 (cam->xml, "main_window"));
                cam->hidden = FALSE;
            }
        } else if (button == 3) {

            //gw = MyApp->GetMainWindow ();

            //gnomemeeting_component_view (NULL, (gpointer) gw->ldap_window);

        }
}
Exemplo n.º 6
0
void idle_stop(void)
{
  if (idle_id != 0)
    {
      gtk_idle_remove(idle_id);
      idle_id = 0;
    }  
}
Exemplo n.º 7
0
/*
 * Remove anchor and idle function.
 */
void Dw_gtk_viewport_remove_anchor (GtkDwViewport *viewport)
{
   if (viewport->anchor) {
      g_free (viewport->anchor);
      viewport->anchor = NULL;
   }

   if (viewport->anchor_idle_id != 0) {
      gtk_idle_remove (viewport->anchor_idle_id);
      viewport->anchor_idle_id = 0;
   }
}
Exemplo n.º 8
0
/* Removes the idle function with the given id. */
int
clip_GTK_IDLEREMOVE(ClipMachine * cm)
{
	guint idle_handler_id = _clip_parni(cm,1);

	CHECKARG(1,NUMERIC_t);

	gtk_idle_remove(idle_handler_id);
	return 0;
err:
	return 1;
}
Exemplo n.º 9
0
int
GTK_system_loop(void)
{
	guint idle_id;
	
	idle_id = gtk_idle_add((GtkFunction) gtk_idle_handler, 0L);

	gtk_main();

	gtk_idle_remove(idle_id);
	return v9t9_return == em_Dying;
}
Exemplo n.º 10
0
static void
cache_maintain_home_close (CMData * cm)
{
    if (cm->idle_id != -1)
	gtk_idle_remove (cm->idle_id);

    if (cm->gd)
	generic_dialog_close (cm->gd);

    path_list_free (cm->list);

    g_list_free (cm->done_list);
    g_free (cm);
}
Exemplo n.º 11
0
void
addIdleCB(GtkWidget *w, State *data)
{
  if(data->id) {
    gtk_idle_remove(data->id);     
    data->id = 0;
#if TO_STDERR
    fprintf(stderr, "Removing idle\n");fflush(stderr);
#endif
  } else {
#if TO_STDERR
    data->id = gtk_idle_add(idleFun, (gpointer) data);
#endif
  }
}
Exemplo n.º 12
0
void
thumb_loader_free (ThumbLoader * tl)
{
    if (!tl)
	return;

    if (tl->pixbuf)
	gdk_pixbuf_unref (tl->pixbuf);
    image_loader_free (tl->il);
    g_free (tl->path);

    if (tl->idle_done_id != -1)
	gtk_idle_remove (tl->idle_done_id);

    g_free (tl);
}
/**
 * Repeatedly works on getting the document updated, since sometimes
 * it takes more than one pass to get the document updated.  But it
 * usually should not take more than a few loops, and certainly never
 * more than 32 iterations.  So we bail out if we hit 32 iterations,
 * since this typically indicates we're stuck in an update loop.
 */
gint
sp_document_ensure_up_to_date(SPDocument *doc)
{
    int counter = 32;
    while (!doc->_updateDocument()) {
        if (counter == 0) {
            g_warning("More than 32 iteration while updating document '%s'", doc->uri);
            break;
        }
        counter--;
    }

    if (doc->modified_id) {
        /* Remove handler */
        gtk_idle_remove(doc->modified_id);
        doc->modified_id = 0;
    }
    return counter>0;
}
Exemplo n.º 14
0
static gint wxlistbox_idle_callback( gpointer gdata )
{
    wxlistbox_idle_struct* data = (wxlistbox_idle_struct*) gdata;
    gdk_threads_enter();

    gtk_idle_remove( data->m_tag );

    // check that the items haven't been deleted from the listbox since we had
    // installed this callback
    wxListBox *lbox = data->m_listbox;
    if ( data->m_item < (int)lbox->GetCount() )
    {
        lbox->SetFirstItem( data->m_item );
    }

    delete data;

    gdk_threads_leave();

    return TRUE;
}
Exemplo n.º 15
0
static void scope_unrealize(GtkWidget *widget)
{
	Scope *scope;

	g_return_if_fail(widget != NULL);
	g_return_if_fail(IS_SCOPE(widget));

	scope = SCOPE(widget);
	if (scope->idlefunc)
		gtk_idle_remove(scope->idlefunc);
	if (scope->trace_gc)
		gtk_gc_release(scope->trace_gc);
	if (scope->grid_gc)
		gtk_gc_release(scope->grid_gc);
	scope->trace_gc = scope->grid_gc = NULL;
	if (scope->pixmap)
			gdk_pixmap_unref(scope->pixmap);
	scope->pixmap = NULL;
	if (GTK_WIDGET_CLASS(parent_class)->unrealize)
		(*GTK_WIDGET_CLASS(parent_class)->unrealize)(widget);
}
SPDocument::~SPDocument() {
    collectOrphans();

    // kill/unhook this first
    if ( profileManager ) {
        delete profileManager;
        profileManager = 0;
    }

    if (priv) {
        if (priv->partial) {
            sp_repr_free_log(priv->partial);
            priv->partial = NULL;
        }

        sp_document_clear_redo(this);
        sp_document_clear_undo(this);

        if (root) {
            root->releaseReferences();
            sp_object_unref(root);
            root = NULL;
        }

        if (priv->iddef) g_hash_table_destroy(priv->iddef);
        if (priv->reprdef) g_hash_table_destroy(priv->reprdef);

        if (rdoc) Inkscape::GC::release(rdoc);

        /* Free resources */
        g_hash_table_foreach_remove(priv->resources, sp_document_resource_list_free, this);
        g_hash_table_destroy(priv->resources);

        delete priv;
        priv = NULL;
    }

    cr_cascade_unref(style_cascade);
    style_cascade = NULL;

    if (name) {
        g_free(name);
        name = NULL;
    }
    if (base) {
        g_free(base);
        base = NULL;
    }
    if (uri) {
        g_free(uri);
        uri = NULL;
    }

    if (modified_id) {
        gtk_idle_remove(modified_id);
        modified_id = 0;
    }

    _selection_changed_connection.disconnect();
    _desktop_activated_connection.disconnect();

    if (keepalive) {
        inkscape_unref();
        keepalive = FALSE;
    }

    if (router) {
        delete router;
        router = NULL;
    }

    //delete this->_whiteboard_session_manager;

}