static gboolean wrap_frame_done_cb (GdkPixbufLoader *loader, 
				    GdkPixbufFrame *frame, 
				    gpointer data)
{
	PyObject *result, *func, *func_data, *frame_python, *loader_python;
	PyObject *func_data_orig;
	PyObject *crap;
	int check;
	long ret;
	int func_data_length;

	//PyGTK_BLOCK_THREADS
	dbg();
	func = (PyObject *) gtk_object_get_data (GTK_OBJECT (loader),
						"py_frame_done_cb_func");
        func_data_orig = (PyObject *) gtk_object_get_data (GTK_OBJECT (loader),
						"py_frame_done_cb_data");

	Py_XINCREF (func_data_orig);
	/*FIXME check if frame_python == NULL ? */
	frame_python = PyGdkPixbuf_FrameNew (frame);

	if (!PyTuple_Check (func_data_orig))
	{	dprint ("f**k, func_data_orig isn't a tuple.\n");
		PyErr_SetString (PyExc_TypeError, 
				"func_data_orig isn't a tuple");
		goto error;
	}

	func_data_length = PyTuple_Size (func_data_orig);
	dprint ("func_data_length == %d\n", func_data_length);

	func_data = PyTuple_New (func_data_length + 2);
	if (func_data == NULL)
		goto error;

	//if (!PyList_Check (func_data))
	//	dprint ("f**k, func_data isn't a list.\n");

	//Py_XINCREF (func_data);

	loader_python = PyGtk_New ((GtkObject *) loader);
	//Py_XINCREF (loader_python);

//	crap = PyTuple_GetItem (func_data, 0); //, loader_python);
//	PyObject_Print (crap, stderr, Py_PRINT_RAW);
//	Py_XDECREF (crap);
	check = PyTuple_SetItem (func_data, 0, loader_python);
	//check = PyList_SetItem (func_data, 0, loader_python);
	dprint ("tried to set item\n");
	if (check != 0)
	{	//dprint ("error appending Loader to arg tuple %d\n", check);
		//Py_XDECREF (func_data);
		//Py_XDECREF (frame_python);
		//return TRUE;
		//PyErr_SetString (PyExc_RuntimeError, 
		//		"error appending frame to arg tuple\n");
		goto error;
	}

	check = PyTuple_SetItem (func_data, 1, frame_python);
	//check = PyList_SetItem (func_data, 1, frame_python);
	if (check != 0)
	{	//dprint ("error appending frame to arg tuple %d\n", check);
		goto error;	
	}

	result = PyObject_CallObject (func, func_data);
	if (result == NULL)
	{	
		//PyErr_Print ();
		//PyErr_Clear ();
		//PyObject_Print (func, stderr, Py_PRINT_RAW);
		//dprint ("error calling function\n");

		goto error;
	}
	
	if (PyInt_Check (result))
		ret = PyInt_AsLong (result);
	else
	  {	
		dprint ("return value of cb isn't an int??\n");
		Py_XDECREF (result);
		PyErr_SetString (PyExc_RuntimeError, 
				"return value of cb isn't an int??\n"); 
		goto error;
	  }

	Py_XDECREF (result);
	return (gboolean) ret;

error:
	Py_XDECREF (func_data);
	Py_XDECREF (frame_python);
	//dprint ("error calling frame_done_cb\n");
	//if (0) //(PyGtk_FatalExceptions)
	if (PyGtk_FatalExceptions)
	  {	//PyErr_Print ();
		//PyErr_Clear ();
		gtk_main_quit ();
	  }
	else
	  {	PyErr_Print ();
		PyErr_Clear ();
	  }
	//PyGTK_UNBLOCK_THREADS
	return TRUE;
}
Example #2
0
static void
detach_term(GtkWidget *widget, ZvtTerm *term)
{
	GtkWidget *term_window;
	GtkWidget *menu_bar;
	GtkWidget *vbox;
	GtkWidget *term_label;
	gchar *label_text;
	gint term_count;
	guint child_died_signal_id;
	guint title_change_signal;

	vbox = gtk_object_get_data(GTK_OBJECT(term), "vbox");
	term_count = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(vbox),
				"term_count"));
	child_died_signal_id = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(term),
				"child_died_signal_id"));
	gtk_signal_disconnect(GTK_OBJECT(term), child_died_signal_id);
	title_change_signal = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(term),
				"title_change_signal"));
	gtk_signal_disconnect(GTK_OBJECT(term), title_change_signal);
	term_label = gtk_object_get_data(GTK_OBJECT(term), "term_label");
	gtk_label_get(GTK_LABEL(term_label), &label_text);

	term_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(term_window), label_text);
	gtk_signal_connect(GTK_OBJECT(term_window), "delete-event",
			GTK_SIGNAL_FUNC(gtk_widget_destroy), term_window);
	gtk_widget_realize(term_window);


	menu_bar = gtk_object_get_data(GTK_OBJECT(term), "menubar");
	gtk_widget_destroy(menu_bar);

	/* Need to use ref and unref with reparent here - don't know why? */
	gtk_widget_ref(GTK_WIDGET(term));
	gtk_widget_reparent(GTK_WIDGET(term), term_window);
	gtk_widget_unref(GTK_WIDGET(term));

	gtk_signal_connect(GTK_OBJECT(term), "child_died",
			GTK_SIGNAL_FUNC(close_term_window), NULL);
	gtk_signal_connect(GTK_OBJECT(term), "title_changed",
			GTK_SIGNAL_FUNC(change_title), term_window);

	
	gtk_widget_grab_focus(GTK_WIDGET(term));

	gtk_widget_show(term_window);

	if(term_count > 1)
	{
		GList *child, *tmp;
		ZvtTerm *tmp_term;
		GtkWidget *ch;
		GtkWidget *page_label;
		GtkWidget *term_label;
		char *label_text;
		gchar buf[NAME_MAX];

		term_count--;
		gtk_object_set_data(GTK_OBJECT(vbox), "term_count",
				GUINT_TO_POINTER(term_count));
		child = GTK_BOX(vbox)->children;

		term_count = 0;
		for(tmp = child; tmp != NULL; tmp = tmp->next)
		{
			ch = ((GtkBoxChild*)(tmp->data))->widget;
			if(ZVT_IS_TERM(ch))
			{
				term_count++;
				gtk_object_set_data(GTK_OBJECT(ch), "term_number",
							GUINT_TO_POINTER(term_count));
			}
		}
		tmp_term = get_nth_zvt(GTK_NOTEBOOK(app.notebook),
				gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook)));
		term_count = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(tmp_term),
					"term_number"));
		gtk_object_set_data(GTK_OBJECT(vbox), "focus_term", 
				GUINT_TO_POINTER(term_count));
		cfg.current_term = tmp_term;
		term_label = gtk_object_get_data(GTK_OBJECT(tmp_term), "term_label");
	 	page_label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(app.notebook),
		gtk_notebook_get_nth_page(GTK_NOTEBOOK(app.notebook), 
		gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook))));
		gtk_label_get(GTK_LABEL(term_label), &label_text);
		g_snprintf(buf, sizeof(buf), "%d %s",
				gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook)) +1,
			 label_text);
		gtk_label_set_text(GTK_LABEL(page_label), buf);


		gtk_widget_grab_focus(GTK_WIDGET(tmp_term));


	}
	else
	{
		gint page;
		gtk_widget_destroy(GTK_WIDGET(vbox));
		gtk_notebook_set_page(GTK_NOTEBOOK(app.notebook), -1);
		page = gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook));
		if(page == 0)
		{
			cfg.term_count = 0;
			cfg.current_term = NULL;
		}
	}
}
Example #3
0
/**
*  \param selection Selection to use; should not be NULL.
*/
static void
sp_item_widget_setup ( SPWidget *spw, Inkscape::Selection *selection )
{
    g_assert (selection != NULL);

    if (gtk_object_get_data (GTK_OBJECT (spw), "blocked"))
        return;

    if (!selection->singleItem()) {
        gtk_widget_set_sensitive (GTK_WIDGET (spw), FALSE);
        return;
    } else {
        gtk_widget_set_sensitive (GTK_WIDGET (spw), TRUE);
    }

    gtk_object_set_data (GTK_OBJECT (spw), "blocked", GUINT_TO_POINTER (TRUE));

    SPItem *item = selection->singleItem();

    /* Sensitive */
    GtkWidget *w = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "sensitive"));
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), item->isLocked());

    /* Hidden */
    w = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "hidden"));
    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), item->isExplicitlyHidden());

    if (SP_OBJECT_IS_CLONED (item)) {

        /* ID */
        w = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "id"));
        gtk_entry_set_text (GTK_ENTRY (w), "");
        gtk_widget_set_sensitive (w, FALSE);
        w = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "id_label"));
        gtk_label_set_text (GTK_LABEL (w), _("Ref"));

        /* Label */
        w = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "label"));
        gtk_entry_set_text (GTK_ENTRY (w), "");
        gtk_widget_set_sensitive (w, FALSE);
        w = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "label_label"));
        gtk_label_set_text (GTK_LABEL (w), _("Ref"));

    } else {
        SPObject *obj = (SPObject*)item;

        /* ID */
        w = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "id"));
        gtk_entry_set_text (GTK_ENTRY (w), obj->getId());
        gtk_widget_set_sensitive (w, TRUE);
        w = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "id_label"));
        gtk_label_set_markup_with_mnemonic (GTK_LABEL (w), _("_Id"));

        /* Label */
        w = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "label"));
        gtk_entry_set_text (GTK_ENTRY (w), obj->defaultLabel());
        gtk_widget_set_sensitive (w, TRUE);

        /* Title */
        w = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(spw), "title"));
        gchar *title = obj->title();
        if (title) {
            gtk_entry_set_text(GTK_ENTRY(w), title);
            g_free(title);
        }
        else gtk_entry_set_text(GTK_ENTRY(w), "");
        gtk_widget_set_sensitive(w, TRUE);

        /* Description */
        w = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(spw), "desc"));
        GtkTextBuffer *buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(w));
        gchar *desc = obj->desc();
        if (desc) {
            gtk_text_buffer_set_text(buf, desc, -1);
            g_free(desc);
        } else {
            gtk_text_buffer_set_text(buf, "", 0);
        }
        w = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(spw), "desc_frame"));
        gtk_widget_set_sensitive(w, TRUE);

        w = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(spw), "interactivity"));

        GtkWidget* int_table = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(spw), "interactivity_table"));
        if (int_table){
            gtk_container_remove(GTK_CONTAINER(w), int_table);
        }

        const gchar* int_labels[10] = {"onclick", "onmouseover", "onmouseout", "onmousedown", "onmouseup", "onmousemove","onfocusin", "onfocusout", "onactivate", "onload"};

        int_table = sp_attribute_table_new (obj, 10, int_labels, int_labels);
        gtk_widget_show_all (int_table);
        gtk_object_set_data(GTK_OBJECT(spw), "interactivity_table", int_table);

        gtk_container_add (GTK_CONTAINER (w), int_table);

    }

    gtk_object_set_data (GTK_OBJECT (spw), "blocked", GUINT_TO_POINTER (FALSE));


} // end of sp_item_widget_setup()
Example #4
0
static void
sp_item_widget_label_changed( GtkWidget */*widget*/, SPWidget *spw )
{
    if (gtk_object_get_data (GTK_OBJECT (spw), "blocked"))
        return;

    SPItem *item = sp_desktop_selection(SP_ACTIVE_DESKTOP)->singleItem();
    g_return_if_fail (item != NULL);

    gtk_object_set_data (GTK_OBJECT (spw), "blocked", GUINT_TO_POINTER (TRUE));

    /* Retrieve the label widget for the object's id */
    GtkWidget *id_entry = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "id"));
    gchar *id = (gchar *) gtk_entry_get_text (GTK_ENTRY (id_entry));
    g_strcanon (id, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.:", '_');
    GtkWidget *id_label = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "id_label"));
    if (!strcmp (id, item->getId())) {
        gtk_label_set_markup_with_mnemonic (GTK_LABEL (id_label), _("_Id"));
    } else if (!*id || !isalnum (*id)) {
        gtk_label_set_text (GTK_LABEL (id_label), _("Id invalid! "));
    } else if (SP_ACTIVE_DOCUMENT->getObjectById(id) != NULL) {
        gtk_label_set_text (GTK_LABEL (id_label), _("Id exists! "));
    } else {
        SPException ex;
        gtk_label_set_markup_with_mnemonic (GTK_LABEL (id_label), _("_Id"));
        SP_EXCEPTION_INIT (&ex);
        sp_object_setAttribute (SP_OBJECT (item), "id", id, &ex);
        sp_document_done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
                                _("Set object ID"));
    }

    /* Retrieve the label widget for the object's label */
    GtkWidget *label_entry = GTK_WIDGET(gtk_object_get_data (GTK_OBJECT (spw), "label"));
    gchar *label = (gchar *)gtk_entry_get_text (GTK_ENTRY (label_entry));
    g_assert(label != NULL);

    /* Give feedback on success of setting the drawing object's label
     * using the widget's label text
     */
    SPObject *obj = (SPObject*)item;
    if (strcmp (label, obj->defaultLabel())) {
        obj->setLabel(label);
        sp_document_done (SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
                                _("Set object label"));
    }

    /* Retrieve the title */
    GtkWidget *w = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(spw), "title"));
    gchar *title = (gchar *)gtk_entry_get_text(GTK_ENTRY (w));
    if (obj->setTitle(title))
        sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
                         _("Set object title"));

    /* Retrieve the description */
    GtkTextView *tv = GTK_TEXT_VIEW(gtk_object_get_data(GTK_OBJECT(spw), "desc"));
    GtkTextBuffer *buf = gtk_text_view_get_buffer(tv);
    GtkTextIter start, end;
    gtk_text_buffer_get_bounds(buf, &start, &end);
    gchar *desc = gtk_text_buffer_get_text(buf, &start, &end, TRUE);
    if (obj->setDesc(desc))
        sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM,
                         _("Set object description"));
    g_free(desc);

    gtk_object_set_data (GTK_OBJECT (spw), "blocked", GUINT_TO_POINTER (FALSE));

} // end of sp_item_widget_label_changed()
bool
type_checkbox (GtkWidget *widget, const gchar *data)
{
    return  gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_object_get_data (GTK_OBJECT (widget), data)));
}
Example #6
0
/*
 * Sets the properties of the widget. This is used for both applying the
 * properties changed in the property editor, and also for loading.
 */
static void
gb_gnome_pixmap_set_properties (GtkWidget * widget, GbWidgetSetArgData * data)
{
  gchar *filename, *old_filename;
  gboolean set_pixmap = FALSE, scaled;
  gint width, height;

  filename = gb_widget_input_pixmap_filename (data, Filename);
  if (data->apply)
    {
      set_pixmap = TRUE;
      if (filename && filename[0] == '\0')
	filename = NULL;

      old_filename = gtk_object_get_data (GTK_OBJECT (widget), Filename);
      if (old_filename)
	{
	  glade_project_remove_pixmap (data->project, old_filename);
	  g_free (old_filename);
	}

      gtk_object_set_data_full (GTK_OBJECT (widget), Filename,
				g_strdup (filename),
				filename ? g_free : NULL);
      if (filename)
	{
	  glade_project_add_pixmap (data->project, filename);
	}
    }
  if (data->action == GB_LOADING)
    g_free (filename);

  scaled = gb_widget_input_bool (data, Scaled);
  if (data->apply)
    {
      set_pixmap = TRUE;
      gtk_object_set_data (GTK_OBJECT (widget), Scaled, scaled ? "Y" : NULL);
      if (property_get_widget() == widget)
	{
	  property_set_sensitive (Width, scaled);
	  property_set_sensitive (Height, scaled);
	}
    }

  width = gb_widget_input_int (data, Width);
  if (data->apply)
    {
      set_pixmap = TRUE;
      if (data->action == GB_LOADING)
	gtk_object_set_data (GTK_OBJECT (widget), Scaled, "Y");
      gtk_object_set_data (GTK_OBJECT (widget), Width,
			   GINT_TO_POINTER (width));
    }

  height = gb_widget_input_int (data, Height);
  if (data->apply)
    {
      set_pixmap = TRUE;
      if (data->action == GB_LOADING)
	gtk_object_set_data (GTK_OBJECT (widget), Scaled, "Y");
      gtk_object_set_data (GTK_OBJECT (widget), Height,
			   GINT_TO_POINTER (height));
    }

  if (set_pixmap)
    gb_gnome_pixmap_reload (widget);
}
Example #7
0
GtkWidget *dt_time_retrieve_inputbox(GtkWidget *hbox)
{
     return gtk_object_get_data(GTK_OBJECT(hbox), "inputbox");
}
Example #8
0
//static 
void param_get(void)
{
	GtkEntry *entry;
	GtkToggleButton *tog;
	char par[64];
	
	/* brag */
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "entry27"));
	strncpy(params.brag.call, gtk_entry_get_text(entry), sizeof(params.brag.call));
	strncpy(params.gtor.mycall, gtk_entry_get_text(entry), sizeof(params.gtor.mycall));
	strncpy(params.pactor.mycall, gtk_entry_get_text(entry), sizeof(params.pactor.mycall));
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "entry28"));
	strncpy(params.brag.op, gtk_entry_get_text(entry), sizeof(params.brag.op));

	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "entry29"));
	strncpy(params.brag.qth, gtk_entry_get_text(entry), sizeof(params.brag.qth));

	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "entry30"));
	strncpy(params.brag.loc, gtk_entry_get_text(entry), sizeof(params.brag.loc));

	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "entry31"));
	strncpy(params.brag.rig, gtk_entry_get_text(entry), sizeof(params.brag.rig));

	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "entry32"));
	strncpy(params.brag.pwr, gtk_entry_get_text(entry), sizeof(params.brag.pwr));

	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "entry33"));
	strncpy(params.brag.ant, gtk_entry_get_text(entry), sizeof(params.brag.ant));

	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "entry34"));
	strncpy(params.brag.www, gtk_entry_get_text(entry), sizeof(params.brag.www));
 	
	/* general */
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "soundcorr"));
	params.general.snd_corr = strtod(gtk_entry_get_text(entry), NULL);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "timecorr"));
	params.general.tv_corr = strtod(gtk_entry_get_text(entry), NULL);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "cpumhzcorr"));
	params.general.cpu_mhz = strtod(gtk_entry_get_text(entry), NULL);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar),
	"soundcardvalue"));
	strncpy(par, gtk_entry_get_text(entry), sizeof(par));
	if (!par[0]) sprintf(par, "none");
 	strncpy(params.general.soundcard, par, sizeof(par));
 	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar),
	"serialvalue"));
	strncpy(par, gtk_entry_get_text(entry), sizeof(par));
	if (!par[0]) sprintf(par, "none");
 	strncpy(params.general.serial, par, sizeof(par));
 	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar),
	"kerneloptions"));
	strncpy(params.general.kerneloptions, gtk_entry_get_text(entry), sizeof(params.general.kerneloptions));
 	
	
	/* FSK parameters */
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "fskspacefreq"));
	params.fsk.freq[0] = strtoul(gtk_entry_get_text(entry), NULL, 0);
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "fskmarkfreq"));
	params.fsk.freq[1] = strtoul(gtk_entry_get_text(entry), NULL, 0);
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "squelchpercent"));
	params.general.squelchpercent = strtoul(gtk_entry_get_text(entry), NULL, 0);
	
	/* CW parameters */
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "wpm"));
	params.cw.wpm = strtoul(gtk_entry_get_text(entry), NULL, 0);
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "tone"));
	params.cw.tone = strtoul(gtk_entry_get_text(entry), NULL, 0);
	tog = GTK_TOGGLE_BUTTON(gtk_object_get_data(GTK_OBJECT(wpar), "farnsworth"));
	params.cw.farnsworth = gtk_toggle_button_get_active(tog);
	tog = GTK_TOGGLE_BUTTON(gtk_object_get_data(GTK_OBJECT(wpar), "dtr"));
	params.cw.dtr = gtk_toggle_button_get_active(tog);
	
	/* RTTY parameters */
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "rttybaudrate"));
	params.rtty.baud = strtod(gtk_entry_get_text(entry), NULL);
	tog = GTK_TOGGLE_BUTTON(gtk_object_get_data(GTK_OBJECT(wpar), "rttyinvert"));
	params.rtty.rxinvert = gtk_toggle_button_get_active(tog);
	tog = GTK_TOGGLE_BUTTON(gtk_object_get_data(GTK_OBJECT(wpar), "rttyrxtxinvert"));
	params.rtty.txinvert = gtk_toggle_button_get_active(tog);
	if (params.rtty.rxinvert)
		params.rtty.txinvert = !params.rtty.txinvert;
	
	/* Amtor parameters */
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "amtordestcall"));
	strncpy(params.amtor.destcall, gtk_entry_get_text(entry), sizeof(params.amtor.destcall));
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "amtormycall"));
	strncpy(params.amtor.mycall, gtk_entry_get_text(entry), sizeof(params.amtor.mycall));
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "amtorselfeccall"));
	strncpy(params.amtor.selfeccall, gtk_entry_get_text(entry), sizeof(params.amtor.selfeccall));
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "amtortxdelay"));
	params.amtor.txdelay = strtoul(gtk_entry_get_text(entry), NULL, 0);
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "amtorretry"));
	params.amtor.retry = strtoul(gtk_entry_get_text(entry), NULL, 0);
	if (params.amtor.retry < 4) params.amtor.retry = 4;
	tog = GTK_TOGGLE_BUTTON(gtk_object_get_data(GTK_OBJECT(wpar), "amtorinvert"));
	params.amtor.rxinvert = gtk_toggle_button_get_active(tog);
	tog = GTK_TOGGLE_BUTTON(gtk_object_get_data(GTK_OBJECT(wpar), "amtorrxtxinvert"));
	params.amtor.txinvert = gtk_toggle_button_get_active(tog);
	if (params.amtor.rxinvert)
		params.amtor.txinvert = !params.amtor.txinvert;
	
	/* GTOR parameters */
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "gtordestcall"));
	strncpy(params.gtor.destcall, gtk_entry_get_text(entry), sizeof(params.gtor.destcall));
	//entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "gtormycall"));
	//strncpy(params.gtor.mycall, gtk_entry_get_text(entry), sizeof(params.gtor.mycall));
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "gtorretry"));
	params.gtor.retry = strtoul(gtk_entry_get_text(entry), NULL, 0);
	if (params.gtor.retry < 4) params.gtor.retry = 4;
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "gtortxdelay"));
	params.gtor.txdelay = strtoul(gtk_entry_get_text(entry), NULL, 0);
	
	/* Pactor parameters */
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "pactorcall"));
	strncpy(params.pactor.destcall, gtk_entry_get_text(entry), sizeof(params.pactor.destcall));
	//entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "pactormycall"));
	//strncpy(params.pactor.mycall, gtk_entry_get_text(entry), sizeof(params.pactor.mycall));
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "pactorretry"));
	params.pactor.retry = strtoul(gtk_entry_get_text(entry), NULL, 0);
	if (params.pactor.retry < 4) params.pactor.retry = 4;
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "pactortxdelay"));
	params.pactor.txdelay = strtoul(gtk_entry_get_text(entry), NULL, 0);
	tog = GTK_TOGGLE_BUTTON(gtk_object_get_data(GTK_OBJECT(wpar), "pactorlongpath"));
	params.pactor.longpath = gtk_toggle_button_get_active(tog);
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "pactorcrc0"));
	params.pactor.crcpreset[0] = strtoul(gtk_entry_get_text(entry), NULL, 16);
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "pactorcrc1"));
	params.pactor.crcpreset[1] = strtoul(gtk_entry_get_text(entry), NULL, 16);
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "pactorcrc2"));
	params.pactor.crcpreset[2] = strtoul(gtk_entry_get_text(entry), NULL, 16);
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "pactorcrc3"));
	params.pactor.crcpreset[3] = strtoul(gtk_entry_get_text(entry), NULL, 16);
	
	/* MT63 parameters */
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "mt63_bandwidth_value"));
	params.mt63.bandwidth = strtoul(gtk_entry_get_text(entry), NULL, 0);
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "mt63_integration"));
	params.mt63.integration = strtoul(gtk_entry_get_text(entry), NULL, 0);
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "mt63_cwcall"));
	strncpy(params.mt63.cwcall, gtk_entry_get_text(entry), sizeof(params.mt63.cwcall));
	tog = GTK_TOGGLE_BUTTON(gtk_object_get_data(GTK_OBJECT(wpar), "mt63_doubleinterleave"));
	params.mt63.doubleinterleave = gtk_toggle_button_get_active(tog);
	
	/* mailbox parameters */
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "mailbox_host"));
	strncpy(params.mailbox.host, gtk_entry_get_text(entry), sizeof(params.mailbox.host));
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "mailbox_port"));
	params.mailbox.port = strtoul(gtk_entry_get_text(entry), NULL, 0);
}
Example #9
0
/*
 * Writes the source code needed to create this widget.
 * You have to output everything necessary to create the widget here, though
 * there are some convenience functions to help.
 */
static void
gb_gnome_druid_page_standard_write_source (GtkWidget * widget,
					   GbWidgetWriteSourceData * data)
{
  GnomeDruidPageStandard *page;
  gchar *filename, *title;
  gchar *wname, *child_name;
  GdkColor title_color, background_color, logo_background_color;
  gboolean title_color_set, background_color_set, logo_background_color_set;

  page = GNOME_DRUID_PAGE_STANDARD (widget);

  /* We do this to make sure the colors are set. */
  gtk_widget_ensure_style (widget);

  if (data->create_widget)
    {
      source_add (data,
		  "  %s = gnome_druid_page_standard_new ();\n",
		  data->wname);
    }

  gb_widget_write_standard_source (widget, data);

  g_object_get (G_OBJECT (widget),
		"title-foreground-set", &title_color_set,
		"title-foreground-gdk", &title_color,
		"background-set", &background_color_set,
		"background-gdk", &background_color,
		"logo-background-set", &logo_background_color_set,
		"logo-background-gdk", &logo_background_color,
		"title", &title,
		NULL);

  if (background_color_set)
    {
      source_add_decl (data,
		       "  GdkColor %s_bg_color = { 0, %i, %i, %i };\n",
		       data->real_wname,
		       background_color.red, background_color.green, background_color.blue);
      source_add (data,
		  "  gnome_druid_page_standard_set_background (GNOME_DRUID_PAGE_STANDARD (%s), &%s_bg_color);\n",
		  data->wname, data->real_wname);
    }

  if (logo_background_color_set)
    {
      source_add_decl (data,
		       "  GdkColor %s_logo_bg_color = { 0, %i, %i, %i };\n",
		       data->real_wname,
		       logo_background_color.red, logo_background_color.green, logo_background_color.blue);
      source_add (data,
		  "  gnome_druid_page_standard_set_logo_background (GNOME_DRUID_PAGE_STANDARD (%s), &%s_logo_bg_color);\n",
		  data->wname, data->real_wname);
    }

  if (title_color_set)
    {
      source_add_decl (data,
		       "  GdkColor %s_title_color = { 0, %i, %i, %i };\n",
		       data->real_wname,
		       title_color.red, title_color.green, title_color.blue);
      source_add (data,
		  "  gnome_druid_page_standard_set_title_foreground (GNOME_DRUID_PAGE_STANDARD (%s), &%s_title_color);\n",
		  data->wname, data->real_wname);
    }

  if (gtk_object_get_data (GTK_OBJECT (widget), ContentsBackgroundColor))
    {
      GdkColor *color = &page->contents_background;
      source_add_decl (data,
		       "  GdkColor %s_contents_bg_color = { 0, %i, %i, %i };\n",
		       data->real_wname,
		       color->red, color->green, color->blue);
      source_add (data,
		  "  gnome_druid_page_standard_set_contents_background (GNOME_DRUID_PAGE_STANDARD (%s), &%s_contents_bg_color);\n",
		  data->wname, data->real_wname);
    }

  if (title && *title)
    {
      gboolean translatable, context;
      gchar *comments;

      glade_util_get_translation_properties (widget, Title, &translatable,
					     &comments, &context);
      source_add_translator_comments (data, translatable, comments);

      source_add (data,
		  "  gnome_druid_page_standard_set_title (GNOME_DRUID_PAGE_STANDARD (%s), %s);\n",
		  data->wname,
		  source_make_string_full (title, data->use_gettext && translatable, context));
    }
  g_free (title);

  filename = gtk_object_get_data (GTK_OBJECT (widget), LogoImage);
  if (filename && filename[0])
    {
      source_ensure_decl (data, "  GdkPixbuf *tmp_pixbuf;\n");

      source_add (data,
		  "  tmp_pixbuf = create_pixbuf (\"%s/%s\");\n"
		  "  if (tmp_pixbuf)\n"
		  "    {\n"
		  "      gnome_druid_page_standard_set_logo (GNOME_DRUID_PAGE_STANDARD (%s),\n"
		  "                                          tmp_pixbuf);\n"
		  "      gdk_pixbuf_unref (tmp_pixbuf);\n"
		  "    }\n",
		  data->program_name, g_basename (filename), data->wname);
    }

  filename = gtk_object_get_data (GTK_OBJECT (widget), TopWatermark);
  if (filename && filename[0])
    {
      source_ensure_decl (data, "  GdkPixbuf *tmp_pixbuf;\n");

      source_add (data,
		  "  tmp_pixbuf = create_pixbuf (\"%s/%s\");\n"
		  "  if (tmp_pixbuf)\n"
		  "    {\n"
		  "      gnome_druid_page_standard_set_top_watermark (GNOME_DRUID_PAGE_STANDARD (%s),\n"
		  "                                                   tmp_pixbuf);\n"
		  "      gdk_pixbuf_unref (tmp_pixbuf);\n"
		  "    }\n",
		  data->program_name, g_basename (filename), data->wname);
    }

  /* We output the source code for the children here, since the code should
     not include calls to create the widgets. We need to specify that the
     names used are like: "GTK_COMBO (<combo-name>)->entry".
     We need to remember the dialog's name since data->wname
     will be overwritten. */
  wname = g_strdup (data->wname);

  source_add (data, "\n");
  child_name = (char*) gtk_widget_get_name (GNOME_DRUID_PAGE_STANDARD (widget)->vbox);
  child_name = source_create_valid_identifier (child_name);
  source_add (data, "  %s = GNOME_DRUID_PAGE_STANDARD (%s)->vbox;\n",
	      child_name, wname);
  g_free (child_name);
  data->create_widget = FALSE;
  gb_widget_write_source (GNOME_DRUID_PAGE_STANDARD (widget)->vbox, data);

  g_free (wname);
  data->write_children = FALSE;
}
Example #10
0
/*****************************************************************************
 * Run: Gtk+ thread
 *****************************************************************************
 * this part of the interface is in a separate thread so that we can call
 * gtk_main() from within it without annoying the rest of the program.
 *****************************************************************************/
static void Run( intf_thread_t *p_intf )
{
#ifndef NEED_GTK2_MAIN
    /* gtk_init needs to know the command line. We don't care, so we
     * give it an empty one */
    char  *p_args[] = { "", NULL };
    char **pp_args  = p_args;
    int    i_args   = 1;
    int    i_dummy;
#endif
    playlist_t        *p_playlist;
    GtkCellRenderer   *p_renderer = NULL;
    GtkTreeViewColumn *p_column   = NULL;
    GtkListStore      *p_filelist = NULL;
    GtkListStore      *p_playlist_store = NULL;

#ifndef NEED_GTK2_MAIN
    gtk_set_locale ();
    msg_Dbg( p_intf, "Starting pda GTK2+ interface" );
    gtk_init( &i_args, &pp_args );
#else
    /* Initialize Gtk+ */
    msg_Dbg( p_intf, "Starting pda GTK2+ interface thread" );
    gdk_threads_enter();
#endif

    /* Create some useful widgets that will certainly be used */
/* FIXME: magic path */
    add_pixmap_directory("share");
    add_pixmap_directory("/usr/share/vlc");

    /* Path for pixmaps under linupy 1.4 */
    add_pixmap_directory("/usr/local/share/pixmaps/vlc");
    /* Path for pixmaps under linupy 2.0 */
    add_pixmap_directory("/usr/share/pixmaps/vlc");

    p_intf->p_sys->p_window = create_pda();
    if (p_intf->p_sys->p_window == NULL)
    {
        msg_Err( p_intf, "unable to create pda interface" );
    }

    /* Store p_intf to keep an eye on it */
    gtk_object_set_data( GTK_OBJECT(p_intf->p_sys->p_window),
                         "p_intf", p_intf );

    /* Set the title of the main window */
    gtk_window_set_title( GTK_WINDOW(p_intf->p_sys->p_window),
                          VOUT_TITLE " (PDA Linux interface)");

    /* Get the notebook object */
    p_intf->p_sys->p_notebook = GTK_NOTEBOOK( gtk_object_get_data(
        GTK_OBJECT( p_intf->p_sys->p_window ), "notebook" ) );

    /* Get the slider object */
    p_intf->p_sys->p_slider = (GtkHScale*) lookup_widget( p_intf->p_sys->p_window, "timeSlider" );
    p_intf->p_sys->p_slider_label = (GtkLabel*) lookup_widget( p_intf->p_sys->p_window, "timeLabel" );
    if (p_intf->p_sys->p_slider == NULL)
        msg_Err( p_intf, "Time slider widget not found." );
    if (p_intf->p_sys->p_slider_label == NULL)
        msg_Err( p_intf, "Time label widget not found." );

    /* Connect the date display to the slider */
    p_intf->p_sys->p_adj = gtk_range_get_adjustment( GTK_RANGE(p_intf->p_sys->p_slider) );
    if (p_intf->p_sys->p_adj == NULL)
        msg_Err( p_intf, "Adjustment range not found." );
    g_signal_connect( GTK_OBJECT( p_intf->p_sys->p_adj ), "value_changed",
                         G_CALLBACK( E_(GtkDisplayDate) ), p_intf );
    p_intf->p_sys->f_adj_oldvalue = 0;
    p_intf->p_sys->i_adj_oldvalue = 0;

    /* BEGIN OF FILEVIEW GTK_TREE_VIEW */
    p_intf->p_sys->p_tvfile = NULL;
    p_intf->p_sys->p_tvfile = (GtkTreeView *) lookup_widget( p_intf->p_sys->p_window,
                                                             "tvFileList");
    if (NULL == p_intf->p_sys->p_tvfile)
       msg_Err(p_intf, "Error obtaining pointer to File List");

    /* Insert columns 0 */
    p_renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 0, (gchar *) N_("Filename"), p_renderer, NULL);
    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 0 );
    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 0 );
    gtk_tree_view_column_set_sort_column_id(p_column, 0);
    /* Insert columns 1 */
    p_renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 1, (gchar *) N_("Permissions"), p_renderer, NULL);
    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 1 );
    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 1 );
    gtk_tree_view_column_set_sort_column_id(p_column, 1);
    /* Insert columns 2 */
    p_renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 2, (gchar *) N_("Size"), p_renderer, NULL);
    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 2 );
    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 2 );
    gtk_tree_view_column_set_sort_column_id(p_column, 2);
    /* Insert columns 3 */
    p_renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 3, (gchar *) N_("Owner"), p_renderer, NULL);
    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 3 );
    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 3 );
    gtk_tree_view_column_set_sort_column_id(p_column, 3);
    /* Insert columns 4 */
    p_renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvfile, 4, (gchar *) N_("Group"), p_renderer, NULL);
    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvfile, 4 );
    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 4 );
    gtk_tree_view_column_set_sort_column_id(p_column, 4);

    /* Get new directory listing */
    p_filelist = gtk_list_store_new (5,
                G_TYPE_STRING, /* Filename */
                G_TYPE_STRING, /* permissions */
                G_TYPE_UINT64, /* File size */
                G_TYPE_STRING, /* Owner */
                G_TYPE_STRING);/* Group */
    ReadDirectory(p_intf, p_filelist, ".");
    gtk_tree_view_set_model(GTK_TREE_VIEW(p_intf->p_sys->p_tvfile), GTK_TREE_MODEL(p_filelist));
    g_object_unref(p_filelist);     /* Model will be released by GtkTreeView */
    gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(p_intf->p_sys->p_tvfile)),GTK_SELECTION_MULTIPLE);

    /* Column properties */
    gtk_tree_view_set_headers_visible(p_intf->p_sys->p_tvfile, TRUE);
    gtk_tree_view_columns_autosize(p_intf->p_sys->p_tvfile);
    gtk_tree_view_set_headers_clickable(GTK_TREE_VIEW(p_intf->p_sys->p_tvfile),TRUE);
    /* END OF FILEVIEW GTK_TREE_VIEW */

    /* BEGIN OF PLAYLIST GTK_TREE_VIEW */
    p_intf->p_sys->p_tvplaylist = NULL;
    p_intf->p_sys->p_tvplaylist = (GtkTreeView *) lookup_widget( p_intf->p_sys->p_window, "tvPlaylist");
    if (NULL == p_intf->p_sys->p_tvplaylist)
       msg_Err(p_intf, "Error obtaining pointer to Play List");

    /* Columns 1 */
    p_renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvplaylist, 0, (gchar *) N_("Filename"), p_renderer, NULL);
    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvplaylist, 0 );
    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 0 );
    gtk_tree_view_column_set_sort_column_id(p_column, 0);
    /* Column 2 */
    p_renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvplaylist, 1, (gchar *) N_("Time"), p_renderer, NULL);
    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvplaylist, 1 );
    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 1 );
    gtk_tree_view_column_set_sort_column_id(p_column, 1);
#if 0
    /* Column 3 - is a hidden column used for reliable deleting items from the underlying playlist */
    p_renderer = gtk_cell_renderer_text_new ();
    gtk_tree_view_insert_column_with_attributes(p_intf->p_sys->p_tvplaylist, 2, (gchar *) N_("Index"), p_renderer, NULL);
    p_column = gtk_tree_view_get_column(p_intf->p_sys->p_tvplaylist, 2 );
    gtk_tree_view_column_add_attribute(p_column, p_renderer, "text", 2 );
    gtk_tree_view_column_set_sort_column_id(p_column, 2);
#endif
    /* update the playlist */
    p_playlist = vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
    p_playlist_store = gtk_list_store_new (3,
                G_TYPE_STRING, /* Filename */
                G_TYPE_STRING, /* Time */
                G_TYPE_UINT);  /* Hidden index */
    PlaylistRebuildListStore(p_playlist_store, p_playlist);
    gtk_tree_view_set_model(GTK_TREE_VIEW(p_intf->p_sys->p_tvplaylist), GTK_TREE_MODEL(p_playlist_store));
    g_object_unref(p_playlist_store);
    vlc_object_release(p_playlist); /* Free the playlist */
    gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(p_intf->p_sys->p_tvplaylist)),GTK_SELECTION_MULTIPLE);

    /* Column properties */
    gtk_tree_view_set_headers_visible(p_intf->p_sys->p_tvplaylist, TRUE);
    gtk_tree_view_columns_autosize(p_intf->p_sys->p_tvplaylist);
    gtk_tree_view_set_headers_clickable(p_intf->p_sys->p_tvplaylist, TRUE);
    /* END OF PLAYLIST GTK_TREE_VIEW */

    /* Hide the Preference TAB for now. */
    GtkWidget *p_preference_tab = NULL;
    p_preference_tab = gtk_notebook_get_nth_page(p_intf->p_sys->p_notebook,5);
    if (p_preference_tab != NULL)
      gtk_widget_hide(p_preference_tab);

    /* Show the control window */
    gtk_widget_show( p_intf->p_sys->p_window );

#ifdef NEED_GTK2_MAIN
    msg_Dbg( p_intf, "Manage GTK keyboard events using threads" );
    while( !p_intf->b_die )
    {
        Manage( p_intf );

        /* Sleep to avoid using all CPU - since some interfaces need to
         * access keyboard events, a 100ms delay is a good compromise */
        gdk_threads_leave();
        if (p_intf->p_libvlc->i_cpu & CPU_CAPABILITY_FPU)
            msleep( INTF_IDLE_SLEEP );
        else
            msleep( 1000 );
        gdk_threads_enter();
    }
#else
    msg_Dbg( p_intf, "Manage GTK keyboard events using timeouts" );
    /* Sleep to avoid using all CPU - since some interfaces needs to access
     * keyboard events, a 1000ms delay is a good compromise */
    if (p_intf->p_libvlc->i_cpu & CPU_CAPABILITY_FPU)
        i_dummy = gtk_timeout_add( INTF_IDLE_SLEEP / 1000, (GtkFunction)Manage, p_intf );
    else
        i_dummy = gtk_timeout_add( 1000, (GtkFunction)Manage, p_intf );

    /* Enter Gtk mode */
    gtk_main();
    /* Remove the timeout */
    gtk_timeout_remove( i_dummy );
#endif

    gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_window) );
#ifdef NEED_GTK2_MAIN
    gdk_threads_leave();
#endif
}
Example #11
0
static void
gb_gnome_druid_page_standard_set_properties (GtkWidget * widget,
					     GbWidgetSetArgData * data)
{
  GnomeDruidPageStandard *page;
  gchar *string, *old_filename;
  GdkColor *color;
  GdkPixbuf *image;

  page = GNOME_DRUID_PAGE_STANDARD (widget);

  string = gb_widget_input_string (data, Title);
  if (data->apply)
    gnome_druid_page_standard_set_title (page, string);

  color = gb_widget_input_color (data, BackgroundColor);
  if (data->apply)
    gnome_druid_page_standard_set_bg_color (page, color);

  color = gb_widget_input_color (data, LogoBackgroundColor);
  if (data->apply)
    gnome_druid_page_standard_set_logo_bg_color (page, color);

  color = gb_widget_input_color (data, TitleColor);
  if (data->apply)
    gnome_druid_page_standard_set_title_color (page, color);

  color = gb_widget_input_color (data, ContentsBackgroundColor);
  if (data->apply)
    {
      gtk_object_set_data (GTK_OBJECT (widget), ContentsBackgroundColor, "Y");
      gnome_druid_page_standard_set_contents_background (page, color);
    }

  string = gb_widget_input_pixmap_filename (data, LogoImage);
  if (data->apply)
    {
      if (string && string[0] == '\0')
	string = NULL;
      old_filename = gtk_object_get_data (GTK_OBJECT (widget), LogoImage);
      glade_project_remove_pixmap (data->project, old_filename);
      gtk_object_set_data_full (GTK_OBJECT (widget), LogoImage,
				g_strdup (string), string ? g_free : NULL);
      glade_project_add_pixmap (data->project, string);
      image = string ? gdk_pixbuf_new_from_file (string, NULL) : NULL;
      gnome_druid_page_standard_set_logo (page, image);
      if (image)
	gdk_pixbuf_unref (image);
    }
  if (data->action == GB_LOADING)
    g_free (string);

  string = gb_widget_input_pixmap_filename (data, TopWatermark);
  if (data->apply)
    {
      if (string && string[0] == '\0')
	string = NULL;
      old_filename = gtk_object_get_data (GTK_OBJECT (widget), TopWatermark);
      glade_project_remove_pixmap (data->project, old_filename);
      gtk_object_set_data_full (GTK_OBJECT (widget), TopWatermark,
				g_strdup (string), string ? g_free : NULL);
      glade_project_add_pixmap (data->project, string);
      image = string ? gdk_pixbuf_new_from_file (string, NULL) : NULL;
      gnome_druid_page_standard_set_top_watermark (page, image);
      if (image)
	gdk_pixbuf_unref (image);
    }
  if (data->action == GB_LOADING)
    g_free (string);
}
Example #12
0
static void sp_image_image_edit(GtkMenuItem *menuitem, SPAnchor *anchor)
{
    SPObject* obj = anchor;
    Inkscape::XML::Node *ir = obj->getRepr();
    const gchar *href = ir->attribute("xlink:href");

    GError* errThing = 0;
    Glib::ustring cmdline = getImageEditorName();
    Glib::ustring name;
    Glib::ustring fullname;
    
#ifdef WIN32
    // g_spawn_command_line_sync parsing is done according to Unix shell rules,
    // not Windows command interpreter rules. Thus we need to enclose the
    // executable path with sigle quotes.
    int index = cmdline.find(".exe");
    if ( index < 0 ) index = cmdline.find(".bat");
    if ( index < 0 ) index = cmdline.find(".com");
    if ( index >= 0 ) {
        Glib::ustring editorBin = cmdline.substr(0, index + 4).c_str();
        Glib::ustring args = cmdline.substr(index + 4, cmdline.length()).c_str();
        editorBin.insert(0, "'");
        editorBin.append("'");
        cmdline = editorBin;
        cmdline.append(args);
    } else {
        // Enclose the whole command line if no executable path can be extracted.
        cmdline.insert(0, "'");
        cmdline.append("'");
    }
#endif

    if (strncmp (href,"file:",5) == 0) {
    // URI to filename conversion
      name = g_filename_from_uri(href, NULL, NULL);
    } else {
      name.append(href);
    }


    if (Glib::path_is_absolute(name)) {
        fullname = name;
    } else if (SP_ACTIVE_DOCUMENT->getBase()) {
        fullname = Glib::build_filename(SP_ACTIVE_DOCUMENT->getBase(), name);
    } else {
        fullname = Glib::build_filename(Glib::get_current_dir(), name);
    }


    cmdline.append(" '");
    cmdline.append(fullname.c_str());
    cmdline.append("'");

    //g_warning("##Command line: %s\n", cmdline.c_str());

    g_spawn_command_line_async(cmdline.c_str(),
                  &errThing); 

    if ( errThing ) {
        g_warning("Problem launching editor (%d). %s", errThing->code, errThing->message);
        SPDesktop *desktop = (SPDesktop*)gtk_object_get_data(GTK_OBJECT(menuitem), "desktop");
        desktop->messageStack()->flash(Inkscape::ERROR_MESSAGE, errThing->message);
        g_error_free(errThing);
        errThing = 0;
    }
}
Example #13
0
/*
 * Writes the source code needed to create this widget.
 * You have to output everything necessary to create the widget here, though
 * there are some convenience functions to help.
 */
static void
gb_gnome_pixmap_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
{
  gchar *filename;
  gboolean scaled;
  gint width, height;

  filename = gtk_object_get_data (GTK_OBJECT (widget), Filename);
  if (filename && !*filename)
    filename = NULL;
  scaled = gtk_object_get_data (GTK_OBJECT (widget), Scaled) != NULL
    ? TRUE : FALSE;
  width = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), Width));
  height = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), Height));

  if (data->create_widget)
    {
      source_add (data,
		  "  %s = g_object_new (GNOME_TYPE_PIXMAP, NULL);\n",
		  data->wname);
    }

  if (filename)
    {
      filename = (gchar*) g_basename (filename);

      source_add_decl (data, "  gchar *%s_filename;\n", data->real_wname);
      /* FIXME: Should convert filename to a valid C string? */
      source_add (data,
		  "  %s_filename = gnome_program_locate_file (NULL,\n"
		  "    GNOME_FILE_DOMAIN_APP_PIXMAP, \"%s/%s\", TRUE, NULL);\n"
		  "  if (%s_filename)\n",
		  data->real_wname,
		  data->program_name, filename,
		  data->real_wname);

      if (scaled)
	{
	  source_add (data,
		      "    gnome_pixmap_load_file_at_size (GNOME_PIXMAP (%s), %s_filename, %i, %i);\n",
		      data->wname, data->real_wname, width, height);
	}
      else
	{
	  source_add (data,
		      "    gnome_pixmap_load_file (GNOME_PIXMAP (%s), %s_filename);\n",
		      data->wname, data->real_wname);
	}

      source_add (data,
		  "  else\n"
		  "    g_warning (%s, ",
		  source_make_string ("Couldn't find pixmap file: %s",
				      data->use_gettext));
      source_add (data,
		  "%s);\n",
		  source_make_string (filename, FALSE));

      source_add (data,  "  g_free (%s_filename);\n", data->real_wname);
    }

  gb_widget_write_standard_source (widget, data);
}
Example #14
0
void on_button_clicked (GtkWidget *button, gpointer user_data)
{
	int x_pos, y_pos;
	int current_pos;	
	gchar file_name[MAXSIZE];	
	struct pos *temp_undo_store_positions;
		
	temp_undo_store_positions = (struct pos *)(malloc(sizeof(struct pos)));
	current_pos = (gint) gtk_object_get_data (GTK_OBJECT(button), "current_pos");

			
	if ( is_legal_slide(current_pos, vacant_pos) ){
       		gtk_widget_set_sensitive(undo_button,TRUE); /* Activate undo button*/
		max_undos_supported_count++;	
			
		x_pos = vacant_pos%4; y_pos = (int)(vacant_pos/4);
		
		 if(temp_undo_store_positions){    
		     temp_undo_store_positions->attach_in_vac_pos = vacant_pos;
	             temp_undo_store_positions->link = undo_store_positions;
		     undo_store_positions = temp_undo_store_positions;		     
		 }else{
			 g_print("unable to allocate memory from heap for undo strcut");			 
			 gtk_main_quit();
			/* Quit application */
		 }

		no_of_valid_undos++;		
		gtk_container_remove (GTK_CONTAINER(table1), button);
		gtk_table_attach (GTK_TABLE (table1), 
			button, x_pos, x_pos + 1, y_pos, y_pos + 1,
			(GtkAttachOptions) GTK_FILL | GTK_EXPAND,
			(GtkAttachOptions) GTK_FILL | GTK_EXPAND,
			(GtkAttachOptions) 1, 1);

		gtk_object_set_data (GTK_OBJECT(button), "current_pos",(gpointer) vacant_pos);
		vacant_pos = current_pos;
		move_no++;
		
		if ( has_player_won() )	{
			gtk_statusbar_push (GTK_STATUSBAR(statusbar1), 0, g_strdup_printf("Eureka You Won the Game with in %i Moves", move_no));		    	     gtk_widget_hide (table1);
			image = gtk_image_new ();
		        sprintf(file_name,"%swon.png",IMAGES_DIR);
		        gtk_image_set_from_file (GTK_IMAGE(image), file_name);
		        gtk_object_ref(GTK_OBJECT(table1));
		        gtk_container_remove (GTK_CONTAINER(alignment1), table1);
		        gtk_container_add (GTK_CONTAINER(alignment1), image);
		        gtk_widget_show (image);
		}else
			gtk_statusbar_push (GTK_STATUSBAR(statusbar1), 0, g_strdup_printf("Move No.: %i", move_no));
	}
	else
		gtk_statusbar_push (GTK_STATUSBAR(statusbar1), 0, "Wrong Move !");


	if(max_undos_supported_count > NO_OF_UNDOS_SUPPORTED){
		max_undos_supported_count=NO_OF_UNDOS_SUPPORTED;		
		free_last_element_in_undo_stack(&undo_store_positions);		
	}

}
Example #15
0
void
GTK_system_report_status(status_item item, va_list va)
{
	char buffer[256];
	GtkLabel *label;
	
	label = GTK_LABEL(gtk_object_get_data(GTK_OBJECT(command_center),
										"progress_label"));
	switch (item)
	{
	case STATUS_CYCLES_SECOND:
	{
		int cyc_avg = va_arg(va, int);
		int inst_avg = va_arg(va, int);
		sprintf(buffer, _("Executing %d cycles per second, "
				"%d instructions per second"),
				cyc_avg, inst_avg);
		gtk_label_set_text(label, buffer);
		break;
	}

	case STATUS_FRAMES_SECOND:
	{
		int frames_avg = va_arg(va, int);
		sprintf(buffer, _("Displaying %d frames per second"),
				frames_avg);
		gtk_label_set_text(label, buffer);
		break;
	}

	case STATUS_DISK_ACCESS:
	case STATUS_RS232_ACCESS:
	{
		GtkWidget *w;
		int num = va_arg(va, int);
		int onoff = va_arg(va, int);
		
		w = (item == STATUS_DISK_ACCESS) ?
			gtk_object_get_data(GTK_OBJECT(v9t9_window), "disk_access_drawing_area") :
			gtk_object_get_data(GTK_OBJECT(v9t9_window), "rs232_access_drawing_area") ;
		if (w)
		{
			GdkColor yellow = { 0xe0, 0xe0, 0x40 };
			GdkColor black = { 0x00, 0x00, 0x00 };
			GtkStyle *style = gtk_widget_get_style(v9t9_window);
			GdkGC *gc = gdk_gc_new(v9t9_window->window);
			gdk_gc_set_foreground(gc, onoff ? &style->fg[4] : &style->bg[0]);
			gdk_draw_rectangle(w->window, 
							   gc,
							   true /*filled*/,
							   0, 0,
							   w->allocation.width, w->allocation.height);
//			gtk_style_unref(style);
//			g_print("%d\n", onoff);
			gdk_gc_unref(gc);
		}
		break;
	}

	case STATUS_DEBUG_REFRESH:
	case STATUS_CPU_PC:
	case STATUS_CPU_STATUS:
	case STATUS_CPU_WP:
	case STATUS_CPU_REGISTER_VIEW:
	case STATUS_CPU_REGISTER_READ:
	case STATUS_CPU_REGISTER_WRITE:
	case STATUS_CPU_INSTRUCTION:
	case STATUS_CPU_INSTRUCTION_LAST:
	case STATUS_MEMORY_VIEW:
	case STATUS_MEMORY_READ:
	case STATUS_MEMORY_WRITE:
		gtk_debugger_report_status(item, va);
		break;

	default:
		logger(LOG_USER|LOG_ERROR, _("Unhandled event %d!"), item);
		break;
	}
}
Example #16
0
/*
 * Writes the source code needed to create this widget.
 * You have to output everything necessary to create the widget here, though
 * there are some convenience functions to help.
 */
static void
gb_menu_tool_button_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
{
  gchar *stock_id, *label, *icon_name;
  gboolean translatable, context;
  gchar *comments;

  stock_id = gtk_object_get_data (GTK_OBJECT (widget),
				  GladeToolButtonStockIDKey);
  icon_name = gtk_object_get_data (GTK_OBJECT (widget),
				   GladeToolButtonIconKey);
  label = (gchar*) gtk_tool_button_get_label (GTK_TOOL_BUTTON (widget));

  glade_util_get_translation_properties (widget, Label, &translatable,
					 &comments, &context);

  if (data->create_widget)
    {
      if (stock_id)
	{
	  /* Stock Button */
	  source_add (data,
		      "  %s = (GtkWidget*) gtk_menu_tool_button_new_from_stock (%s);\n",
		      data->wname, source_make_string (stock_id, FALSE));
	}
      else if (icon_name)
	{
	  /* Icon and Label */
	  source_ensure_decl (data, "  GtkWidget *tmp_image;\n");

	  if (glade_util_check_is_stock_id (icon_name))
	    {
	      source_add (data,
			  "  tmp_image = gtk_image_new_from_stock (\"%s\", tmp_toolbar_icon_size);\n",
			  icon_name);
	    }
	  else
	    {
	      source_create_pixmap (data, "tmp_image", icon_name);
	    }

	  source_add (data, "  gtk_widget_show (tmp_image);\n");

	  source_add_translator_comments (data, translatable, comments);
	  source_add (data,
		      "  %s = (GtkWidget*) gtk_menu_tool_button_new (tmp_image, %s);\n",
		      data->wname,
		      label ? source_make_string_full (label, data->use_gettext && translatable, context) : "NULL");
	}
      else
	{
	  /* Just a Label */
	  source_add_translator_comments (data, translatable, comments);
	  source_add (data,
		      "  %s = (GtkWidget*) gtk_menu_tool_button_new (NULL, %s);\n",
		      data->wname,
		      label ? source_make_string_full (label, data->use_gettext && translatable, context) : "NULL");
	}
    }

  gb_widget_write_standard_source (widget, data);

  if (gtk_object_get_data (GTK_OBJECT (widget), VisibleHorz) != NULL)
    {
      source_add (data,
		  "  gtk_tool_item_set_visible_horizontal (GTK_TOOL_ITEM (%s), FALSE);\n",
		  data->wname);
    }

  if (gtk_object_get_data (GTK_OBJECT (widget), VisibleVert) != NULL)
    {
      source_add (data,
		  "  gtk_tool_item_set_visible_vertical (GTK_TOOL_ITEM (%s), FALSE);\n",
		  data->wname);
    }

  if (gtk_tool_item_get_is_important (GTK_TOOL_ITEM (widget)))
    {
      source_add (data,
		  "  gtk_tool_item_set_is_important (GTK_TOOL_ITEM (%s), TRUE);\n",
		  data->wname);
    }
}
Example #17
0
gint gw_plugin_settings_search_pane_load ( GtkWidget *pane)
{
	gint result = -1;
	GtkToggleButton *chk_bt = NULL;
	gfloat value = -1;


#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
	g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
#endif

	if ( pane != NULL )
	{
#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
	g_print ( "*** GW - %s (%d) :: %s() : loading...\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
#endif

		/* Checks case sensitive sort option. */
		if ( (chk_bt = GTK_TOGGLE_BUTTON ( gtk_object_get_data ( GTK_OBJECT ( pane), GW_PLUGIN_SETTINGS_SEARCH_SORT_CASE_SENSITIVE_CHK))) != NULL)
		{
#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
			g_print ( "*** GW - %s (%d) :: %s() : getting the case sensitive sort option...\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
#endif

			if ( (value = gw_am_get_settings_tod ( GW_VALUE_APP_SEARCH_SORT_CASE_SENSITIVE)) == -1 )
			{
				value = GW_VALUE_APP_SEARCH_SORT_CASE_SENSITIVE_DEFAULT;
			}

#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
			g_print ( "*** GW - %s (%d) :: %s() : case sensitive sort option is %f\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, value);
#endif

			gtk_toggle_button_set_active ( chk_bt, (gboolean)value);
		}
		else
		{
#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
			g_print ( "*** GW - %s (%d) :: %s() : warning no check button!!\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
#endif
		}

		chk_bt = NULL;

		/* Checks sort group by option. */
		if ( (chk_bt = GTK_TOGGLE_BUTTON ( gtk_object_get_data ( GTK_OBJECT ( pane), GW_PLUGIN_SETTINGS_SEARCH_SORT_GROUP_BY_TYPE_CHK))) != NULL)
		{
#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
			g_print ( "*** GW - %s (%d) :: %s() : getting the sort group by option...\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
#endif

			if ( (value = gw_am_get_settings_tod ( GW_VALUE_APP_SEARCH_SORT_BY_TYPE)) == -1 )
			{
				value = GW_VALUE_APP_SEARCH_SORT_BY_TYPE_DEFAULT;
			}

#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
			g_print ( "*** GW - %s (%d) :: %s() : sort group by option is %f\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, value);
#endif

			gtk_toggle_button_set_active ( chk_bt, (gboolean)value);
		}
		else
		{
#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
			g_print ( "*** GW - %s (%d) :: %s() : warning no check button!!\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
#endif
		}

		chk_bt = NULL;

		/* Checks autoresize option. */
		if ( (chk_bt = GTK_TOGGLE_BUTTON ( gtk_object_get_data ( GTK_OBJECT ( pane), GW_PLUGIN_SETTINGS_SEARCH_AUTORESIZE_COLUMN_CHK))) != NULL)
		{
#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
			g_print ( "*** GW - %s (%d) :: %s() : getting the autoresize option...\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
#endif

			if ( (value = gw_am_get_settings_tod ( GW_VALUE_APP_SEARCH_COLUMN_AUTORESIZE)) == -1 )
			{
				value = GW_VALUE_APP_SEARCH_COLUMN_AUTORESIZE_DEFAULT;
			}

#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
			g_print ( "*** GW - %s (%d) :: %s() : autoresize option is %f\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, value);
#endif

			gtk_toggle_button_set_active ( chk_bt, (gboolean)value);
		}
		else
		{
#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
			g_print ( "*** GW - %s (%d) :: %s() : warning no check button!!\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
#endif
		}

		chk_bt = NULL;

		/* Checks key words mode option. */
		if ( (chk_bt = GTK_TOGGLE_BUTTON ( gtk_object_get_data ( GTK_OBJECT ( pane), GW_PLUGIN_SETTINGS_SEARCH_KEY_WORDS_MODE_CHK))) != NULL)
		{
#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
			g_print ( "*** GW - %s (%d) :: %s() : getting the key words mode option...\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
#endif

			if ( (value = gw_am_get_settings_tod ( GW_VALUE_APP_SEARCH_TYPE_KEY_WORDS_MODE)) == -1 )
			{
				value = GW_VALUE_APP_SEARCH_TYPE_KEY_WORDS_MODE_DEFAULT;
			}

#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
			g_print ( "*** GW - %s (%d) :: %s() : key words mode option is %f\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, value);
#endif

			gtk_toggle_button_set_active ( chk_bt, (gboolean)value);
		}
		else
		{
#ifdef GW_DEBUG_PLUGIN_SETTINGS_COMPONENT
			g_print ( "*** GW - %s (%d) :: %s() : warning no check button!!\n", __FILE__, __LINE__, __PRETTY_FUNCTION__);
#endif
		}

		chk_bt = NULL;

		result = 0;
	}

	return result;
}
Example #18
0
//static 
void param_set(void)
{
	GtkEntry *entry;
	GtkToggleButton *tog;
	char buf[256];

	/* brag */

	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "entry27"));
	strncpy(buf, params.brag.call, sizeof(params.brag.call));
	buf[sizeof(params.brag.call)] = 0;
	gtk_entry_set_text(entry, buf);

	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "entry28"));
	strncpy(buf, params.brag.op, sizeof(params.brag.op));
	buf[sizeof(params.brag.op)] = 0;
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "entry29"));
	strncpy(buf, params.brag.qth, sizeof(params.brag.qth));
	buf[sizeof(params.brag.qth)] = 0;
	gtk_entry_set_text(entry, buf);

	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "entry30"));
	strncpy(buf, params.brag.loc, sizeof(params.brag.loc));
	buf[sizeof(params.brag.loc)] = 0;
	gtk_entry_set_text(entry, buf);

	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "entry31"));
	strncpy(buf, params.brag.rig, sizeof(params.brag.rig));
	buf[sizeof(params.brag.rig)] = 0;
	gtk_entry_set_text(entry, buf);

	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "entry32"));
	strncpy(buf, params.brag.pwr, sizeof(params.brag.pwr));
	buf[sizeof(params.brag.pwr)] = 0;
	gtk_entry_set_text(entry, buf);

	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "entry33"));
	strncpy(buf, params.brag.ant, sizeof(params.brag.ant));
	buf[sizeof(params.brag.ant)] = 0;
	gtk_entry_set_text(entry, buf);

	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "entry34"));
	strncpy(buf, params.brag.www, sizeof(params.brag.www));
	buf[sizeof(params.brag.www)] = 0;
	gtk_entry_set_text(entry, buf);
 
	/* general */
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "soundcorr"));
	snprintf(buf, sizeof(buf), "%f", params.general.snd_corr);
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "timecorr"));
	snprintf(buf, sizeof(buf), "%f", params.general.tv_corr);
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "cpumhzcorr"));
	snprintf(buf, sizeof(buf), "%f", params.general.cpu_mhz);
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar),
	"soundcardvalue"));
	strncpy(buf, params.general.soundcard, sizeof(params.general.soundcard));
	buf[sizeof(params.general.soundcard)] = 0;
	gtk_entry_set_text(entry, buf);
	 	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar),
	"serialvalue"));
	strncpy(buf, params.general.serial, sizeof(params.general.serial));
	buf[sizeof(params.general.serial)] = 0;
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar),
	"kerneloptions"));
	strncpy(buf, params.general.kerneloptions, sizeof(params.general.kerneloptions));
	buf[sizeof(params.general.kerneloptions)] = 0;
	gtk_entry_set_text(entry, buf);
		
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "beaconpausevalue"));
	snprintf(buf, sizeof(buf), "%u", params.general.beaconpause);
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "squelchpercent"));
	snprintf(buf, sizeof(buf), "%u", params.general.squelchpercent);
	gtk_entry_set_text(entry, buf);
		
	/* FSK parameters */
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "fskspacefreq"));
	snprintf(buf, sizeof(buf), "%u", params.fsk.freq[0]);
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "fskmarkfreq"));
	snprintf(buf, sizeof(buf), "%u", params.fsk.freq[1]);
	gtk_entry_set_text(entry, buf);
	
	/* CW parameters */
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "wpm"));
	snprintf(buf, sizeof(buf), "%u", params.cw.wpm);
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "tone"));
	snprintf(buf, sizeof(buf), "%u", params.cw.tone);
	gtk_entry_set_text(entry, buf);
	
	tog = GTK_TOGGLE_BUTTON(gtk_object_get_data(GTK_OBJECT(wpar), "farnsworth"));
	gtk_toggle_button_set_active(tog, params.cw.farnsworth);
	
	tog = GTK_TOGGLE_BUTTON(gtk_object_get_data(GTK_OBJECT(wpar), "dtr"));
	gtk_toggle_button_set_active(tog, params.cw.dtr);
	
	
	/* RTTY parameters */
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "rttybaudrate"));
	snprintf(buf, sizeof(buf), "%f", params.rtty.baud);
	gtk_entry_set_text(entry, buf);
	
	tog = GTK_TOGGLE_BUTTON(gtk_object_get_data(GTK_OBJECT(wpar), "rttyinvert"));
	gtk_toggle_button_set_active(tog, params.rtty.rxinvert);
	
	tog = GTK_TOGGLE_BUTTON(gtk_object_get_data(GTK_OBJECT(wpar), "rttyrxtxinvert"));
	gtk_toggle_button_set_active(tog, params.rtty.txinvert ^ params.rtty.rxinvert);
	
	
	/* Amtor parameters */
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "amtordestcall"));
	strncpy(buf, params.amtor.destcall, sizeof(params.amtor.destcall));
	buf[sizeof(params.amtor.destcall)] = 0;
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "amtormycall"));
	strncpy(buf, params.amtor.mycall, sizeof(params.amtor.mycall));
	buf[sizeof(params.amtor.mycall)] = 0;
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "amtorselfeccall"));
	strncpy(buf, params.amtor.selfeccall, sizeof(params.amtor.selfeccall));
	buf[sizeof(params.amtor.selfeccall)] = 0;
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "amtortxdelay"));
	snprintf(buf, sizeof(buf), "%u", params.amtor.txdelay);
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "amtorretry"));
	snprintf(buf, sizeof(buf), "%u", params.amtor.txdelay);
	gtk_entry_set_text(entry, buf);
	
	tog = GTK_TOGGLE_BUTTON(gtk_object_get_data(GTK_OBJECT(wpar), "amtorinvert"));
	gtk_toggle_button_set_active(tog, params.amtor.rxinvert);
	
	tog = GTK_TOGGLE_BUTTON(gtk_object_get_data(GTK_OBJECT(wpar), "amtorrxtxinvert"));
	gtk_toggle_button_set_active(tog, params.amtor.txinvert ^ params.amtor.rxinvert);
	
	
	/* GTOR parameters */
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "gtordestcall"));
	strncpy(buf, params.gtor.destcall, sizeof(params.gtor.destcall));
	buf[sizeof(params.gtor.destcall)] = 0;
	gtk_entry_set_text(entry, buf);
	
	//entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "gtormycall"));
	//strncpy(buf, params.gtor.mycall, sizeof(params.gtor.mycall));
	//buf[sizeof(params.gtor.mycall)] = 0;
	//gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "gtorretry"));
	snprintf(buf, sizeof(buf), "%u", params.gtor.retry);
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "gtortxdelay"));
	snprintf(buf, sizeof(buf), "%u", params.gtor.txdelay);
	gtk_entry_set_text(entry, buf);
	/* Pactor parameters */
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "pactorcall"));
	strncpy(buf, params.pactor.destcall, sizeof(params.pactor.destcall));
	buf[sizeof(params.pactor.destcall)] = 0;
	gtk_entry_set_text(entry, buf);
	
	//entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "pactormycall"));
	//strncpy(buf, params.pactor.mycall, sizeof(params.pactor.mycall));
	//buf[sizeof(params.pactor.mycall)] = 0;
	//gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "pactorretry"));
	snprintf(buf, sizeof(buf), "%u", params.pactor.retry);
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "pactortxdelay"));
	snprintf(buf, sizeof(buf), "%u", params.pactor.txdelay);
	gtk_entry_set_text(entry, buf);
	
	tog = GTK_TOGGLE_BUTTON(gtk_object_get_data(GTK_OBJECT(wpar), "pactorlongpath"));
	gtk_toggle_button_set_active(tog, params.pactor.longpath);
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "pactorcrc0"));
	snprintf(buf, sizeof(buf), "%04X", params.pactor.crcpreset[0]);
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "pactorcrc1"));
	snprintf(buf, sizeof(buf), "%04X", params.pactor.crcpreset[1]);
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "pactorcrc2"));
	snprintf(buf, sizeof(buf), "%04X", params.pactor.crcpreset[2]);
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "pactorcrc3"));
	snprintf(buf, sizeof(buf), "%04X", params.pactor.crcpreset[3]);
	gtk_entry_set_text(entry, buf);
	
	
	/* MT63 parameters */
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "mt63_bandwidth_value"));
	snprintf(buf, sizeof(buf), "%u", params.mt63.bandwidth);
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "mt63_integration"));
	snprintf(buf, sizeof(buf), "%u", params.mt63.integration);
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "mt63_cwcall"));
	strncpy(buf, params.mt63.cwcall, sizeof(params.mt63.cwcall));
	buf[sizeof(params.mt63.cwcall)] = 0;
	gtk_entry_set_text(entry, buf);
	
	tog = GTK_TOGGLE_BUTTON(gtk_object_get_data(GTK_OBJECT(wpar), "mt63_doubleinterleave"));
	gtk_toggle_button_set_active(tog, params.mt63.doubleinterleave);
	
	
	/* mailbox parameters */
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "mailbox_host"));
	strncpy(buf, params.mailbox.host, sizeof(params.mailbox.host));
	buf[sizeof(params.mailbox.host)] = 0;
	gtk_entry_set_text(entry, buf);
	
	entry = GTK_ENTRY(gtk_object_get_data(GTK_OBJECT(wpar), "mailbox_port"));
	snprintf(buf, sizeof(buf), "%d", params.mailbox.port);
	gtk_entry_set_text(entry, buf);
}
Example #19
0
void perform_uninstall_slot(GtkWidget* w, gpointer data)
{
    GtkWidget *notebook;
    GtkWidget *progress;
    GtkWidget *widget;
    GList *list, *poopy, *clist;
    GtkWidget *button;
    component_list *component;
    size_t size, total;
    char text[1024];
	const char *message;

	/* Set through environment to hide questions, and assume Yes */
	int show_messages;
	const char *env;

	show_messages = 1;

	env = getenv("SETUP_NO_PROMPT");
	if ( env && atoi(env) )
		show_messages = 0;


    /* First switch to the next notebook page */
    notebook = glade_xml_get_widget(uninstall_glade, "uninstall_notebook");
    gtk_notebook_set_page(GTK_NOTEBOOK(notebook), 1);
    widget = glade_xml_get_widget(uninstall_glade, "finished_button");
    if ( widget ) {
        gtk_button_set_sensitive(widget, FALSE);
    }

    /* Now uninstall all the selected components */
    progress = glade_xml_get_widget(uninstall_glade, "uninstall_progress");
    size = 0;
    total = calculate_recovered_space();
    widget = glade_xml_get_widget(uninstall_glade, "uninstall_vbox");
    list = gtk_container_children(GTK_CONTAINER(widget));
    while ( list && ! uninstall_cancelled ) {
        widget = GTK_WIDGET(list->data);
        poopy = gtk_container_children(GTK_CONTAINER(widget));
        widget = GTK_WIDGET(poopy->data);
        /* First do the addon components */
        clist = gtk_container_children(GTK_CONTAINER(widget));
        while ( clist && ! uninstall_cancelled ) {
            button = GTK_WIDGET(clist->data);
            if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)) ) {
                component = gtk_object_get_data(GTK_OBJECT(button), "data");
                if ( loki_isdefault_component(component->component) ) {
                    clist = clist->next;
                    continue;
                }
                /* Put up the status */
                snprintf(text, sizeof(text), "%s: %s",
                        component->info->description,
                        loki_getname_component(component->component));
                set_status_text(text);

                /* See if the user wants to cancel the uninstall */
                while( gtk_events_pending() ) {
                    gtk_main_iteration();
                }
				
				/* Display an optional message to the user */
				message = loki_getmessage_component(component->component);
				if (show_messages && message && !display_message(message, BUTTON_OK|BUTTON_ABORT) ) {
                    clist = clist->next;
					uninstall_cancelled = 1;
					break;
				}

                /* Remove the component */
                if ( ! uninstall_component(component->component, component->info) ) {
					uninstall_cancelled = 2;
					snprintf(text, sizeof(text), _("Uninstallation of component %s has failed!\n"
												   "The whole uninstallation may be incomplete.\n"),
							 loki_getname_component(component->component));
					display_message(text, BUTTON_ABORT);
					break;
				}

                /* Update the progress bar */
                if ( total && progress ) {
                    size += component->size/1024;
                    gtk_progress_set_percentage(GTK_PROGRESS(progress),
                                                (float)size/total);
                }
                gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE);

                /* See if the user wants to cancel the uninstall */
                while( gtk_events_pending() ) {
                    gtk_main_iteration();
                }
            }
            clist = clist->next;
        }
        /* Now do the primary components */
        clist = gtk_container_children(GTK_CONTAINER(widget));
        while ( clist && ! uninstall_cancelled ) {
            button = GTK_WIDGET(clist->data);
            if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)) ) {
                component = gtk_object_get_data(GTK_OBJECT(button), "data");
                if ( ! loki_isdefault_component(component->component) ) {
                    clist = clist->next;
                    continue;
                }
                /* Put up the status */
                strncpy(text, component->info->description, sizeof(text));
                set_status_text(text);

                /* See if the user wants to cancel the uninstall */
                while( gtk_events_pending() ) {
                    gtk_main_iteration();
                }

				/* Display an optional message to the user */
				message = loki_getmessage_component(component->component);
				if ( message && !display_message(message, BUTTON_OK|BUTTON_ABORT) ) {
                    clist = clist->next;
					uninstall_cancelled = 1;
					break;
				}

                /* Remove the component */
                if ( ! perform_uninstall(component->product, component->info, 0) ) {
					uninstall_cancelled = 2;
					snprintf(text, sizeof(text), _("Uninstallation of product %s has failed!\n"
												   "Aborting the rest of the uninstallation.\n"),
							 component->info->description);
					display_message(text, BUTTON_ABORT);
					break;
				}
                remove_product(component->product);

                /* Update the progress bar */
                if ( total && progress ) {
                    size += component->size/1024;
                    gtk_progress_set_percentage(GTK_PROGRESS(progress),
                                                (float)size/total);
                }

                /* See if the user wants to cancel the uninstall */
                while( gtk_events_pending() ) {
                    gtk_main_iteration();
                }
                break;
            }
            clist = clist->next;
        }
        list = list->next;
    }
    switch ( uninstall_cancelled ) {
	case 1:
        set_status_text(_("Uninstall cancelled"));
		break;
	case 2:
        set_status_text(_("Uninstall aborted"));
		break;
	default:
        set_status_text(_("Uninstall complete"));
		gtk_progress_set_percentage(GTK_PROGRESS(progress), 1.0f);
		break;
    }
    widget = glade_xml_get_widget(uninstall_glade, "cancel_button");
    if ( widget ) {
        gtk_button_set_sensitive(widget, FALSE);
    }
    widget = glade_xml_get_widget(uninstall_glade, "finished_button");
    if ( widget ) {
        gtk_button_set_sensitive(widget, TRUE);
    }
}
void
sp_find_reset_searchfield (GObject *dlg, const gchar *field)
{
    GtkWidget *widget = GTK_WIDGET (gtk_object_get_data (GTK_OBJECT (dlg), field));
    gtk_entry_set_text (GTK_ENTRY(widget), "");
}
Example #21
0
void
gl_window_draw_grid(GtkGLArea *glarea)
{
  gl_window_info *info = gtk_object_get_data(GTK_OBJECT(glarea), "info");
  GLfloat top, left, right, bottom, x, y;
  static GLfloat line_spacing = 5;
  gint line_count, i;

  // don't draw grid for texture ball
  if(info->orientation == ORIENTATION_TEXTURE)
    return;

  line_count = (int) rintf(info->x_median / line_spacing) + 1;

  if(line_count > 10){
    line_spacing *= 2.0;
    line_count = (int) rintf(info->x_median / line_spacing) + 1;
  }else if(line_count < 6){
    line_spacing /= 2.0;
    line_count = (int) rintf(info->x_median / line_spacing) + 1;
  }

  /* set top, bottom, left and right ordinates */
  if(info->orientation == ORIENTATION_3D){

    /* in 3d mode, draw a grid on the Y = 0 plane */

    top = 0.90 * info->y_median;

    if(top < 10) top = 10;

    top -= fmod(top, line_spacing);
    bottom = -top;

    right = top;
    left  = bottom;

    line_count = rintf(right / line_spacing) + 1;
  }else{
    top    = info->y_median * -1;
    bottom = info->y_median;

    left   = info->x_median * -1;
    right  = info->x_median;
  }

  if (gtk_gl_area_make_current(GTK_GL_AREA(glarea))){
    glMatrixMode(GL_MODELVIEW);
    switch(info->orientation)
      {
      case ORIENTATION_FRONT:	break;
      case ORIENTATION_3D:	glRotatef(-90, 1,0,0);  break;
      case ORIENTATION_TOP:	glRotatef(-90, 1,0,0);	break;
      case ORIENTATION_BOTTOM:	glRotatef( 90, 1,0,0);	break;
      case ORIENTATION_LEFT:	glRotatef(90, 0,1,0);	break;
      case ORIENTATION_RIGHT:	glRotatef(-90, 0,1,0);	break;
      case ORIENTATION_BACK:	glRotatef(180, 0,1,0);	break;
      default: break;
      }

    glColor3f(0.3, 0.3, 0.3);
    glBegin(GL_LINES);

    /* draw x=0 z=0 line */
    glVertex3f( 0, top,    0 );
    glVertex3f( 0, bottom, 0 );

    /* draw y=0 z=0 line */
    glVertex3f( left,  0, 0 );
    glVertex3f( right, 0, 0 );

    for(i = 0; i < line_count; i++){

      y = line_spacing * i;
      x = y;

      glVertex3f( -x, top,    0 );
      glVertex3f( -x, bottom, 0 );

      glVertex3f( x, bottom, 0 );
      glVertex3f( x, top,    0 );

      glVertex3f( left,  y, 0 );
      glVertex3f( right, y, 0 );

      glVertex3f( right, -y, 0 );
      glVertex3f( left,  -y, 0 );
      
    }
    glEnd();

    switch(info->orientation)
      {
      case ORIENTATION_FRONT:	break;
      case ORIENTATION_3D:	glRotatef(90, 1,0,0);  break;
      case ORIENTATION_TOP:	glRotatef(90, 1,0,0);	break;
      case ORIENTATION_BOTTOM:	glRotatef(-90, 1,0,0);	break;
      case ORIENTATION_LEFT:	glRotatef(-90, 0,1,0);	break;
      case ORIENTATION_RIGHT:	glRotatef(90, 0,1,0);	break;
      case ORIENTATION_BACK:	glRotatef(180, 0,1,0);	break;
      default: break;
      }
  }


  return;
}