Ejemplo n.º 1
0
static GWENHYWFAR_CB
int Gtk3Gui_WGroupBox_SetCharProperty(GWEN_WIDGET *w,
                                      GWEN_DIALOG_PROPERTY prop,
                                      int index,
                                      const char *value,
                                      int doSignal)
{
  GtkWidget *g;

  g=GTK_WIDGET(GWEN_Widget_GetImplData(w, GTK3_DIALOG_WIDGET_REAL));
  assert(g);

  switch (prop) {
  case GWEN_DialogProperty_Title:
    gtk_frame_set_label(GTK_FRAME(g), value);
    return 0;
  default:
    break;
  }

  DBG_WARN(GWEN_LOGDOMAIN,
           "Function is not appropriate for this type of widget (%s)",
           GWEN_Widget_Type_toString(GWEN_Widget_GetType(w)));
  return GWEN_ERROR_INVALID;
}
Ejemplo n.º 2
0
void wxStaticBox::SetLabel( const wxString &label )
{
    wxControl::SetLabel( label );

    gtk_frame_set_label( GTK_FRAME( m_widget ),
                         m_label.empty() ? (char *)NULL : (const char*) wxGTK_CONV( m_label ) );
}
/* Reset the statistics window */
static void
rlc_lte_stat_reset(void *phs)
{
    rlc_lte_stat_t* rlc_lte_stat = (rlc_lte_stat_t *)phs;
    rlc_lte_ep_t* list = rlc_lte_stat->ep_list;
    gchar title[256];
    GtkListStore *store;

    /* Set the title */
    if (rlc_lte_stat->dlg_w != NULL) {
        g_snprintf(title, sizeof(title), "Wireshark: LTE RLC Traffic Statistics: %s (filter=\"%s\")",
                   cf_get_display_name(&cfile),
                   rlc_lte_stat->filter ? rlc_lte_stat->filter : "none");
        gtk_window_set_title(GTK_WINDOW(rlc_lte_stat->dlg_w), title);
    }

    g_snprintf(title, sizeof(title), "0 UEs");
    gtk_frame_set_label(GTK_FRAME(rlc_lte_stat->ues_lb), title);

    rlc_lte_stat->total_frames = 0;
    memset(&rlc_lte_stat->common_stats, 0, sizeof(rlc_lte_common_stats));

    /* Remove all entries from the UE list */
    store = GTK_LIST_STORE(gtk_tree_view_get_model(rlc_lte_stat->ue_table));
    gtk_list_store_clear(store);

    if (!list) {
        return;
    }

    rlc_lte_stat->ep_list = NULL;
}
Ejemplo n.º 4
0
void gFrame::setText(const char *vl)
{
	if (!vl)
		vl = "";

	gtk_frame_set_label(GTK_FRAME(fr), vl);

	/*bool remove = false;
	
	remove = !vl || !*vl;
	
	if (remove)
	{
		if (label) 
		{
			gtk_frame_set_label_widget(GTK_FRAME(fr), NULL);
			label = NULL;
		}
		return;
	}
	
	if (!label)
	{
		label = gtk_label_new(vl);
		gtk_frame_set_label_widget(GTK_FRAME(fr), label);
		updateFont();
		setForeground(foreground());
		gtk_widget_show(label);
	}
	else
		gtk_label_set_text(GTK_LABEL(label), (const gchar*)vl);*/
}
Ejemplo n.º 5
0
void wxRadioBox::SetLabel( const wxString& label )
{
    wxCHECK_RET( m_widget != NULL, wxT("invalid radiobox") );

    wxControl::SetLabel( label );

    gtk_frame_set_label( GTK_FRAME(m_widget), wxGTK_CONV( wxControl::GetLabel() ) );
}
Ejemplo n.º 6
0
static void
wlanstat_reset (void *phs)
{
	wlanstat_t* wlan_stat = (wlanstat_t *)phs;
	wlan_ep_t* list = wlan_stat->ep_list;
	wlan_ep_t* tmp = NULL;
	char title[256];
	GString *error_string;
	GtkListStore *store;
	const char *filter = NULL;

	if (wlanstat_dlg_w != NULL) {
            g_snprintf (title, sizeof(title), "Wireshark: WLAN Traffic Statistics: %s",
			    cf_get_display_name(&cfile));
		gtk_window_set_title(GTK_WINDOW(wlanstat_dlg_w), title);
	}

	if (wlan_stat->use_dfilter) {
		filter = gtk_entry_get_text(GTK_ENTRY(main_display_filter_widget));
	}

	error_string = set_tap_dfilter (wlan_stat, filter);
	if (error_string) {
		simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", error_string->str);
		g_string_free(error_string, TRUE);
		return;
	}

	if (wlan_stat->use_dfilter) {
		if (filter && strlen(filter)) {
                    g_snprintf(title, sizeof(title), "Network Overview - Filter: %s", filter);
		} else {
                    g_snprintf(title, sizeof(title), "Network Overview - No Filter");
		}
	} else {
		g_snprintf(title, sizeof(title), "Network Overview");
	}
	gtk_frame_set_label(GTK_FRAME(wlanstat_name_lb), title);

	/* remove all entries from the list */
	store = GTK_LIST_STORE(gtk_tree_view_get_model(wlan_stat->table));
	gtk_list_store_clear(store);
	store = GTK_LIST_STORE(gtk_tree_view_get_model(wlan_stat->details));
	gtk_list_store_clear(store);

	if (!list)
		return;

	while (list) {
		tmp = list;
		dealloc_wlan_details_ep (tmp->details);
		list = tmp->next;
		g_free (tmp);
	}

	wlan_stat->ep_list = NULL;
	wlan_stat->number_of_packets = 0;
}
Ejemplo n.º 7
0
static int gtkFrameSetTitleAttrib(Ihandle* ih, const char* value)
{
  if (iupAttribGetStr(ih, "_IUPFRAME_HAS_TITLE"))
  {
    GtkFrame* frame = (GtkFrame*)ih->handle;
    gtk_frame_set_label(frame, iupgtkStrConvertToUTF8(value));
  }
  return 0;
}
Ejemplo n.º 8
0
void size_callb (gpointer data,GtkWidget *wdg) {
	// Sets size when creating a new HF
	gint hf_size;
	static gchar area_label[12];
	omenu_struct_type *opt_menu;
	hf_wrapper_struct *hfw;
	hf_options_struct *hfo;
	opt_menu = (omenu_struct_type *) data;
//	printf("DATA in SIZE_CALLB: %d;\n",data);
	hfo = (hf_options_struct *) opt_menu->data;
//	printf("HFO in SIZE_CALLB: %d;\n",hfo);
	if (!hfo)
		return;

	hfw = (hf_wrapper_struct *) * (hf_wrapper_struct **)  hfo->hfw_ptr_ptr;

	hf_size = opt_menu->list[opt_menu->current_index].num;
	if (!hfw)
		return;
	if (!hfw->hf_struct)
		return;
	if (hf_size == hfw->hf_struct->max_x)
		//	No change!
		return;

	sprintf(area_label, "%d x %d", hf_size, hf_size);
	gtk_frame_set_label(GTK_FRAME(hfw->draw_area_frame), area_label);

	hf_free(hfw->hf_struct);
	hfw->hf_options->hf_size = hf_size;
	hfw->hf_struct = (hf_struct_type *) hf_new(hf_size);
	hfw->display_scale = get_display_scale(hf_size);
	hfw->hf_buf8 = (unsigned char *) x_malloc((RIGHT_SHIFT(hf_size, hfw->display_scale)) * (RIGHT_SHIFT(hf_size,hfw->display_scale))*sizeof(unsigned char), "unsigned char (hfw->buf8 in size_callb)");
	hfw->if_rgb = FALSE;
	hfw->area_size = RIGHT_SHIFT(hf_size,hfw->display_scale);
	set_current_button (hfw->sbs, hfw->display_scale);
	hfw->size_change_request = TRUE;
	
	gtk_widget_set_size_request (hfw->draw_area_frame, hfw->area_size+SCALE_PAD, hfw->area_size+SCALE_PAD);

//	printf("SIZE_CALLB: HFW: %d; HF_SIZE: %d; DISPLAY_SCALE: %d; AREA_SIZE: %d\n", hfw, hf_size, hfw->display_scale, hfw->area_size);
	
	init_render_struct(hfw->hf_options->render_str, 
		hfw->dirname, 
		hfw->filename, 
		&hfw->creation_mode,
		hfw->if_modified,
		hfw->gl_preview,
		hfw->hf_struct->hf_buf,
		hfw->hf_struct->max_x,
		hfw->hf_struct->max_y);

	gl_set_input_grid (hfw->gl_preview, hfw->hf_struct->hf_buf, hfw->hf_struct->max_x, hfw->hf_struct->max_y, HF_TYPE_ID);
	gl_update_details_display (hfw->gl_preview);
	gtk_drawing_area_size(GTK_DRAWING_AREA(hfw->area), 
		hfw->area_size, hfw->area_size);
}
Ejemplo n.º 9
0
void wxControl::GTKSetLabelForFrame(GtkFrame *w, const wxString& label)
{
    wxControl::SetLabel(label);

    const wxString labelGTK = GTKRemoveMnemonics(label);

    gtk_frame_set_label(w, labelGTK.empty() ? (const char *)NULL
                        : wxGTK_CONV(labelGTK));
}
static void kovaplusconfig_sensitivity_frame_init(KovaplusconfigSensitivityFrame *frame) {
	frame->priv = KOVAPLUSCONFIG_SENSITIVITY_FRAME_GET_PRIVATE(frame);
	frame->priv->scale = GAMINGGEAR_XY_SCALES(gaminggear_xy_scales_new(
			(gdouble)KOVAPLUS_SENSITIVITY_MIN,
			(gdouble)KOVAPLUS_SENSITIVITY_MAX,
			(gdouble)1.0));
	gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(frame->priv->scale));
	gtk_frame_set_label(GTK_FRAME(frame), _("Sensitivity"));
}
Ejemplo n.º 11
0
static	void
SetFrame(
	GtkWidget		*widget,
	WidgetData	*wdata,
	_Frame			*data)
{
ENTER_FUNC;
	SetCommon(widget,wdata);
	gtk_frame_set_label(GTK_FRAME(widget),data->label);
LEAVE_FUNC;
}
Ejemplo n.º 12
0
/**
 * facq_display_set_title:
 * @dis: A #FacqDisplay object.
 * @title: A string with the text for the title.
 *
 * Sets the text in the label of the toplevel #GtkFrame.
 */
void facq_display_set_title(FacqDisplay *dis,const gchar *title)
{
	g_return_if_fail(FACQ_IS_DISPLAY(dis));
	g_return_if_fail(title);

	if(dis->priv->title)
		g_free(dis->priv->title);

	dis->priv->title = g_strdup(title);
	gtk_frame_set_label(GTK_FRAME(dis->priv->frame),dis->priv->title);
}
Ejemplo n.º 13
0
Archivo: test-gtk.c Proyecto: nedko/mx
int
main (int argc, char **argv)
{
    GtkWidget *window, *vbox, *frame, *swtch, *swtch2, *toggle, *vbox2;
    gboolean is_active = FALSE;

    gtk_init (&argc, &argv);

    if (argc > 1)
        is_active = atoi (argv[1]);

    g_debug ("setting switch to '%d'", is_active);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_default_size (GTK_WINDOW (window), 320, 240);

    vbox = gtk_vbox_new (FALSE, 12);
    gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
    gtk_container_add (GTK_CONTAINER (window), vbox);

    frame = mx_gtk_frame_new ();
    gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 10);
    gtk_frame_set_label (GTK_FRAME (frame), "Frame Title");

    vbox2 = gtk_vbox_new (FALSE, 12);
    gtk_container_set_border_width (GTK_CONTAINER (vbox2), 10);
    gtk_container_add (GTK_CONTAINER (frame), vbox2);

    swtch = mx_gtk_light_switch_new ();
    mx_gtk_light_switch_set_active (MX_GTK_LIGHT_SWITCH (swtch), is_active);
    gtk_container_add (GTK_CONTAINER (vbox2), swtch);

    swtch2 = mx_gtk_light_switch_new ();
    gtk_widget_set_sensitive (swtch2, FALSE);
    mx_gtk_light_switch_set_active (MX_GTK_LIGHT_SWITCH (swtch2), is_active);
    gtk_container_add (GTK_CONTAINER (vbox2), swtch2);

    frame = gtk_alignment_new (0, 0, 0, 0);
    gtk_alignment_set_padding (GTK_ALIGNMENT (frame), 10, 10, 10, 10);
    gtk_container_add (GTK_CONTAINER (vbox), frame);

    toggle = gtk_toggle_button_new_with_label ("Toggle");
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle), is_active);
    gtk_container_add (GTK_CONTAINER (frame), toggle);
    g_signal_connect (toggle, "toggled", G_CALLBACK (_toggle_cb), swtch);

    gtk_widget_show_all (window);
    g_signal_connect (window, "delete-event", gtk_main_quit, NULL);

    gtk_main ();

    return 0;
}
Ejemplo n.º 14
0
void
ghack_menu_window_end_menu (GtkWidget *menuWin, gpointer data)
{
  const char* p = (const char*) data;

  if ((p) && (*p)) {
    GtkWidget *frame1 = gtk_object_get_data (GTK_OBJECT (menuWin), "frame1");
    g_assert (frame1 != NULL);

    gtk_frame_set_label (GTK_FRAME(frame1), p);
  }

}
Ejemplo n.º 15
0
static void
callback_frame_thumbnail_press (GtkWidget * event_box,
    GdkEventButton * event, gpointer user_data)
{
  GtkWidget *label;
  gchar *file_name;
  gchar *name;
  gchar *frame_name_markup;
  gint frame_num;

  frame_num = (gint) user_data;

  name = g_strdup_printf ("%s-%d.xml", ui->codec_name, frame_num);
  file_name = g_build_filename (ui->analyzer_home, "xml", name, NULL);
  if (ui->current_xml)
    g_free (ui->current_xml);
  g_free (name);
  ui->current_xml = file_name;

  name = g_strdup_printf ("%s-%d.hex", ui->codec_name, frame_num);
  file_name = g_build_filename (ui->analyzer_home, "hex", name, NULL);
  if (ui->current_hex)
    g_free (ui->current_hex);
  g_free (name);
  ui->current_hex = file_name;

  g_signal_connect (G_OBJECT (ui->header_button), "button-press-event",
      G_CALLBACK (callback_button_box_click),
      (gpointer) COMPONENTS_HEADERS_GENERAL);
  g_signal_connect (G_OBJECT (ui->slice_button), "button-press-event",
      G_CALLBACK (callback_button_box_click),
      (gpointer) COMPONENTS_HEADERS_SLICE);
  g_signal_connect (G_OBJECT (ui->hexval_button), "button-press-event",
      G_CALLBACK (callback_button_box_click), (gpointer) COMPONENTS_HEXVAL);

  /* load general headers by default */
  callback_button_box_click (NULL, NULL, (gpointer) COMPONENTS_HEADERS_GENERAL);

  /*update the label of parsed_info_frame with frame_number */
  gtk_frame_set_label (GTK_FRAME (ui->parsed_info_frame), "");
  label = gtk_frame_get_label_widget (GTK_FRAME (ui->parsed_info_frame));
  frame_name_markup =
      g_markup_printf_escaped
      ("<span style=\"italic\" size=\"xx-large\">Frame %d</span>",
      frame_num + 1);
  gtk_label_set_markup (GTK_LABEL (label), frame_name_markup);
  g_free (frame_name_markup);

  gtk_widget_show_all (ui->main_window);
}
Ejemplo n.º 16
0
static void
reset_analyzer_ui (void)
{

  if (ui->hbox1_in_vbox2) {
    gtk_widget_destroy (GTK_WIDGET (ui->hbox1_in_vbox2));
    ui->hbox1_in_vbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
    g_object_set (G_OBJECT (ui->hbox1_in_vbox2), "visible", TRUE,
        "can-focus", FALSE, NULL);
    gtk_container_add (GTK_CONTAINER (ui->thumbnails_view_port),
        ui->hbox1_in_vbox2);
  }

  if (ui->general_info_treeview) {
    gtk_widget_destroy (GTK_WIDGET (ui->general_info_treeview));
    ui->general_info_treeview = gtk_tree_view_new ();
    gtk_box_pack_end (GTK_BOX (ui->general_info_vbox),
        ui->general_info_treeview, TRUE, TRUE, 0);
  }

  if (ui->parsed_info_button_box) {
    gtk_widget_destroy (GTK_WIDGET (ui->parsed_info_button_box));
    ui->parsed_info_button_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
    g_object_set (G_OBJECT (ui->parsed_info_button_box), "visible", TRUE,
        "can-focus", TRUE, NULL);
    gtk_box_pack_start (GTK_BOX (ui->parsed_info_hbox),
        ui->parsed_info_button_box, FALSE, FALSE, 0);
  }
  if (ui->parsed_info_vbox) {
    gtk_widget_destroy (GTK_WIDGET (ui->parsed_info_vbox));
    ui->parsed_info_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 2);
    g_object_set (G_OBJECT (ui->parsed_info_vbox), "visible", TRUE,
        "can-focus", TRUE, NULL);
    gtk_box_pack_start (GTK_BOX (ui->parsed_info_hbox), ui->parsed_info_vbox,
        TRUE, TRUE, 0);
  }

  if (ui->parsed_info_frame)
    gtk_frame_set_label (GTK_FRAME (ui->parsed_info_frame), "");

  if (ui->notebook_hash)
    g_hash_table_destroy (ui->notebook_hash);
  ui->notebook_hash = g_hash_table_new (g_str_hash, g_str_equal);

  ui->prev_page = NULL;

  gtk_widget_show_all (ui->main_window);
}
static void konepuremilitary_sensor_alignment_frame_init(KonepuremilitarySensorAlignmentFrame *frame) {
	KonepuremilitarySensorAlignmentFramePrivate *priv = KONEPUREMILITARY_SENSOR_ALIGNMENT_FRAME_GET_PRIVATE(frame);
	GtkWidget *hbox;

	frame->priv = priv;

	hbox = gtk_hbox_new(FALSE, 0);
	priv->scale = scale_new();
	priv->flag = GTK_CHECK_BUTTON(gtk_check_button_new_with_label(_("Active")));

	gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(priv->flag), FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(priv->scale), TRUE, TRUE, 0);
	gtk_container_add(GTK_CONTAINER(frame), hbox);

	gtk_frame_set_label(GTK_FRAME(frame), _("Sensor alignment"));
}
static void konepuremilitary_anglesnap_frame_init(KonepuremilitaryAnglesnapFrame *frame) {
	KonepuremilitaryAnglesnapFramePrivate *priv = KONEPUREMILITARY_ANGLESNAP_FRAME_GET_PRIVATE(frame);
	GtkWidget *hbox;

	frame->priv = priv;

	hbox = gtk_hbox_new(FALSE, 0);
	priv->scale = scale_new();
	priv->flag = GTK_CHECK_BUTTON(gtk_check_button_new_with_label(_("Active")));

	gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(priv->flag), FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(priv->scale), TRUE, TRUE, 0);
	gtk_container_add(GTK_CONTAINER(frame), hbox);

	gtk_frame_set_label(GTK_FRAME(frame), _("Angle snapping"));
}
Ejemplo n.º 19
0
int main( int   argc,
          char *argv[] )
{
  /* GtkWidget is the storage type for widgets */
  GtkWidget *window;
  GtkWidget *frame;
  GtkWidget *button;
  gint i;

  /* Initialise GTK */
  gtk_init(&argc, &argv);
    
  /* Create a new window */
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title(GTK_WINDOW(window), "Frame Example");

  /* Here we connect the "destroy" event to a signal handler */ 
  gtk_signal_connect (GTK_OBJECT (window), "destroy",
                      GTK_SIGNAL_FUNC (gtk_main_quit), NULL);

  gtk_widget_set_usize(window, 300, 300);
  /* Sets the border width of the window. */
  gtk_container_set_border_width (GTK_CONTAINER (window), 10);

  /* Create a Frame */
  frame = gtk_frame_new(NULL);
  gtk_container_add(GTK_CONTAINER(window), frame);

  /* Set the frame's label */
  gtk_frame_set_label( GTK_FRAME(frame), "GTK Frame Widget" );

  /* Align the label at the right of the frame */
  gtk_frame_set_label_align( GTK_FRAME(frame), 1.0, 0.0);

  /* Set the style of the frame */
  gtk_frame_set_shadow_type( GTK_FRAME(frame), GTK_SHADOW_ETCHED_OUT);

  gtk_widget_show(frame);
  
  /* Display the window */
  gtk_widget_show (window);
    
  /* Enter the event loop */
  gtk_main ();
    
  return(0);
}
Ejemplo n.º 20
0
static void roccat_handedness_selector_init(RoccatHandednessSelector *selector) {
	RoccatHandednessSelectorPrivate *priv = ROCCAT_HANDEDNESS_SELECTOR_GET_PRIVATE(selector);
	GtkWidget *hbox;

	selector->priv = priv;

	hbox = gtk_hbox_new(TRUE, 0);
	gtk_container_add(GTK_CONTAINER(selector), hbox);

	priv->left = GTK_RADIO_BUTTON(gtk_radio_button_new_with_label(NULL, _("Left handed")));
	gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(priv->left), TRUE, TRUE, 0);

	priv->right = GTK_RADIO_BUTTON(gtk_radio_button_new_with_label_from_widget(priv->left, _("Right handed")));
	gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(priv->right), TRUE, TRUE, 0);

	gtk_frame_set_label(GTK_FRAME(selector), _("Handedness"));
}
Ejemplo n.º 21
0
/* control frequency */
static void
on_freq_changed (GtkRange * range, gpointer user_data)
{
  GstObject *band = GST_OBJECT (user_data);
  gdouble value = gtk_range_get_value (range);

  /* hbox */
  GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (range));

  /* frame */
  GtkWidget *parent_parent = gtk_widget_get_parent (parent);
  gchar *label = g_strdup_printf ("%d Hz", (int) (value + 0.5));

  gtk_frame_set_label (GTK_FRAME (parent_parent), label);
  g_free (label);

  g_object_set (band, "freq", value, NULL);
}
Ejemplo n.º 22
0
static void nyth_light_effects_frame_init(NythLightEffectsFrame *frame) {
	NythLightEffectsFramePrivate *priv = NYTH_LIGHT_EFFECTS_FRAME_GET_PRIVATE(frame);
	GtkBox *box;

	frame->priv = priv;

	box = GTK_BOX(gtk_vbox_new(FALSE, 0));

	add_radios_color_effect(box, frame);
	gtk_box_pack_start(box, gtk_hseparator_new(), TRUE, TRUE, 0);
	add_radios_light_effect(box, frame);
	gtk_box_pack_start(box, gtk_hseparator_new(), TRUE, TRUE, 0);
	add_speed(box, frame);

	gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(box));

	gtk_frame_set_label(GTK_FRAME(frame), _("Light effects"));
}
Ejemplo n.º 23
0
void usb_register( void )
{
	FILE *pd;
	
	gtk_frame_set_label( GTK_FRAME( body_frame), "Installation step - 3/5 (register a usb device)" );
	
	status_label = gtk_label_new("...");
	gtk_table_attach_defaults ( GTK_TABLE (main_table), status_label, 1, 11, 1, 9);
	gtk_widget_show( status_label );
	gtk_label_set_text( GTK_LABEL( status_label), "Insert the USB device. ( it will be used to unlock the system )\n\n\nIf the desired USB device is already inserted then simply remove it to register." );
	
	pd = popen( "lsusb | wc -l", "r" );
	system( "lsusb > old_data" );
	fscanf( pd, "%d", &old_lscount );
	pclose( pd );
	
	gtk_timeout_add( 1000, register_new_usb, NULL );
}
Ejemplo n.º 24
0
void start_final_installation( void )
{
	gtk_frame_set_label( GTK_FRAME( body_frame), "Installation step - 5/5 ( managing source files )" );
	gtk_button_set_label( GTK_BUTTON( cancel_button), "Finish" );
	gtk_widget_set_sensitive( GTK_WIDGET( cancel_button), FALSE );
	pattern_label = gtk_label_new( "" );
	gtk_container_add( GTK_CONTAINER( body_frame), pattern_label );
	
	gtk_widget_show_all( main_window );
	
	fd = popen( "whoami", "r" );
	fscanf( fd, "%s", system_user_name );
	pclose(fd);
	
	create_directories();
	create_files();
	manage_files();
}
Ejemplo n.º 25
0
int
ags_machine_popup_rename_response_callback(GtkWidget *widget, gint response, AgsMachine *machine)
{
  gchar *text;

  if(response == GTK_RESPONSE_ACCEPT){
    if(machine->name != NULL)
      free(machine->name);

    text = gtk_editable_get_chars(GTK_EDITABLE(gtk_container_get_children((GtkContainer *) GTK_DIALOG(widget)->vbox)->data), 0, -1);
    machine->name = text;

    gtk_frame_set_label((GtkFrame *) gtk_container_get_children((GtkContainer *) machine)->data, g_strconcat(G_OBJECT_TYPE_NAME(machine), ": \0", text, NULL));
    g_free(text);
  }

  gtk_widget_destroy(widget);

  return(0);
}
static void ryosconfig_illumination_frame_init(RyosconfigIlluminationFrame *illumination_frame) {
    RyosconfigIlluminationFramePrivate *priv = RYOSCONFIG_ILLUMINATION_FRAME_GET_PRIVATE(illumination_frame);
    illumination_frame->priv = priv;
    GtkBox *hbox;
    GtkButton *layer_illumination_button;

    priv->pointer = NULL;

    hbox = GTK_BOX(gtk_hbox_new(FALSE, 0));
    layer_illumination_button = GTK_BUTTON(gtk_button_new_with_label(_("Editor")));
    priv->multiwidget = ROCCAT_MULTIWIDGET(roccat_multiwidget_new());
    priv->table = GTK_TABLE(gtk_table_new(3, 2, FALSE));
    priv->nothing = GTK_LABEL(gtk_label_new(_("This model does not support illumination settings")));
    priv->mode = RYOS_LAYER_MODE_SELECTOR(ryos_layer_mode_selector_new());
    priv->layer = RYOS_LAYER_SELECTOR(ryos_layer_selector_new());
    priv->effect = RYOSCONFIG_EFFECT_SELECTOR(ryosconfig_effect_selector_new());

    gtk_label_set_line_wrap(GTK_LABEL(priv->nothing), TRUE);

    g_signal_connect(G_OBJECT(layer_illumination_button), "clicked", G_CALLBACK(layer_illumination_dialog_cb), illumination_frame);
    priv->mode_changed_handler_id = g_signal_connect(G_OBJECT(priv->mode), "changed", G_CALLBACK(mode_changed_cb), illumination_frame);
    priv->layer_changed_handler_id = g_signal_connect(G_OBJECT(priv->layer), "changed", G_CALLBACK(layer_changed_cb), illumination_frame);
    priv->effect_changed_handler_id = g_signal_connect(G_OBJECT(priv->effect), "changed", G_CALLBACK(effect_changed_cb), illumination_frame);

    gtk_box_pack_start(hbox, GTK_WIDGET(priv->layer), TRUE, TRUE, 0);
    gtk_box_pack_start(hbox, GTK_WIDGET(layer_illumination_button), FALSE, FALSE, 0);

    gtk_table_attach(priv->table, gtk_label_new(_("Mode")), 0, 1, 0, 1, 0, GTK_EXPAND, 0, 0);
    gtk_table_attach(priv->table, GTK_WIDGET(priv->mode), 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND, 0, 0);
    gtk_table_attach(priv->table, gtk_label_new(_("Layer")), 0, 1, 1, 2, 0, GTK_EXPAND, 0, 0);
    gtk_table_attach(priv->table, GTK_WIDGET(hbox), 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_EXPAND, 0, 0);
    gtk_table_attach(priv->table, gtk_label_new(_("Effect")), 0, 1, 2, 3, 0, GTK_EXPAND, 0, 0);
    gtk_table_attach(priv->table, GTK_WIDGET(priv->effect), 1, 2, 2, 3, GTK_EXPAND | GTK_FILL, GTK_EXPAND, 0, 0);

    roccat_multiwidget_add(priv->multiwidget, GTK_WIDGET(priv->table));
    roccat_multiwidget_add(priv->multiwidget, GTK_WIDGET(priv->nothing));

    gtk_container_add(GTK_CONTAINER(illumination_frame), GTK_WIDGET(priv->multiwidget));

    gtk_frame_set_label(GTK_FRAME(illumination_frame), _("Illumination"));
}
Ejemplo n.º 27
0
static void nyth_dcu_frame_init(NythDcuFrame *frame) {
	NythDcuFramePrivate *priv = NYTH_DCU_FRAME_GET_PRIVATE(frame);
	GtkWidget *box;
	GtkWidget *radio;
	int i;

	frame->priv = priv;

	box = gtk_vbox_new(FALSE, 0);

	gtk_container_add(GTK_CONTAINER(frame), box);

	struct {
		NythControlUnitDcu state;
		gchar const *title;
	} radios[4] = {
		{NYTH_DISTANCE_CONTROL_UNIT_OFF, N_("Off")},
		{NYTH_DISTANCE_CONTROL_UNIT_EXTRA_LOW, N_("Extra low")},
		{NYTH_DISTANCE_CONTROL_UNIT_LOW, N_("Low")},
		{NYTH_DISTANCE_CONTROL_UNIT_NORMAL, N_("Normal")},
	};

	priv->radios = NULL;

	for (i = 3; i >= 0; --i) {
		radio = gtk_radio_button_new_with_label(priv->radios, _N(radios[i].title));
		g_object_set_data(G_OBJECT(radio), state_key, GUINT_TO_POINTER(radios[i].state));
		priv->radios = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio));
		g_signal_connect(G_OBJECT(radio), "toggled", G_CALLBACK(radio_toggled_cb), frame);
	}

	g_slist_foreach(priv->radios, pack_radio_button, box);

	gtk_frame_set_label(GTK_FRAME(frame), _("Distance control unit"));

	gtk_widget_show_all(box);
}
Ejemplo n.º 28
0
static void refreshFrames(void)
{
	struct viewport *pp = NULL;
	GList *it = ports;
	int mypage_i;
	gchar *title = NULL;

	while (it)
	{
		pp = (struct viewport *)(it->data);

		/* the beamer has no frame */
		if (pp->isBeamer == FALSE)
		{
			/* reset background color */
			gtk_widget_modify_bg(pp->frame->parent, GTK_STATE_NORMAL,
					NULL);

			/* lock mode: highlight the saved/current page */
			if (beamer_active == FALSE)
			{
				if (doc_page + pp->offset == doc_page_mark)
				{
					gtk_widget_modify_bg(pp->frame->parent,
							GTK_STATE_NORMAL, &col_marked);
				}
				else if (pp->offset == 0)
				{
					gtk_widget_modify_bg(pp->frame->parent,
							GTK_STATE_NORMAL, &col_dim);
				}
			}
			/* normal mode: highlight the "current" frame */
			else
			{
				if (pp->offset == 0)
				{
					gtk_widget_modify_bg(pp->frame->parent,
							GTK_STATE_NORMAL, &col_current);
				}
			}

			/* Refresh labels. */
			if (pp->frame != NULL)
			{
				mypage_i = pagenumForPort(pp);
				if (mypage_i < 0 || mypage_i >= doc_n_pages)
				{
					gtk_frame_set_label(GTK_FRAME(pp->frame), "X");
				}
				else
				{
					title = g_strdup_printf("Slide %d / %d", mypage_i + 1,
							doc_n_pages);
					gtk_frame_set_label(GTK_FRAME(pp->frame), title);
					g_free(title);
				}
			}
		}

		it = g_list_next(it);
	}
}
Ejemplo n.º 29
0
static gboolean onCanvasDraw(GtkWidget *widget, cairo_t *cr,
		struct viewport *pp)
{
	(void)widget;

	int mypage_i, myfitmode = -1;
	gdouble w = 0, h = 0;
	gchar *title = NULL;
	gdouble popwidth, popheight;
	gdouble tx, ty;
	gdouble screen_ratio, page_ratio, scale;
	PopplerPage *page = NULL;

	/* no valid target size? */
	if (pp->width <= 0 || pp->height <= 0)
		return TRUE;

	/* decide which page to render - if any */
	mypage_i = pagenumForPort(pp);

	if (mypage_i < 0 || mypage_i >= doc_n_pages)
	{
		/* We don't do any drawing and set the frame's title to "X".
		 * Thus, we'll end up with an "empty" frame. */
		if (pp->frame != NULL)
			gtk_frame_set_label(GTK_FRAME(pp->frame), "X");

		return TRUE;
	}
	else
	{
		/* update frame title */
		if (pp->frame != NULL)
		{
			title = g_strdup_printf("Slide %d / %d", mypage_i + 1,
					doc_n_pages);
			gtk_frame_set_label(GTK_FRAME(pp->frame), title);
			g_free(title);
		}
	}

	/* if note-control is active, print current page number if on
	 * "main" frame. (don't do this on the beamer because it could be
	 * locked.)
	 * this allows you to attach any kind of other program or script
	 * which can show notes for a specific slide. simply pipe the
	 * output of pdfpres to your other tool.
	 */
	if (pp->offset == 0 && !pp->isBeamer)
	{
		printNote(doc_page + 1);
		if (runpref.do_notectrl)
		{
			printf("%d\n", doc_page + 1);
			fflush(stdout);
		}
	}

	/* Get the page and it's size from the document. */
	page = poppler_document_get_page(doc, mypage_i);
	poppler_page_get_size(page, &popwidth, &popheight);
	
	/* Set page number */
	if (pp->isBeamer)
	{
	    gtk_label_set_text(GTK_LABEL(curPageLabel), 
	        g_strdup_printf("%s/%d", poppler_page_get_label(page), doc_last_page));
	}

	/* Select fit mode. */
	page_ratio = popwidth / popheight;
	screen_ratio = (double)pp->width / (double)pp->height;

	if (runpref.fit_mode == FIT_PAGE)
	{
		/* That's it: Compare screen and page ratio. This
		 * will cover all 4 cases that could happen. */
		if (screen_ratio > page_ratio)
			myfitmode = FIT_HEIGHT;
		else
			myfitmode = FIT_WIDTH;
	}
	else
		myfitmode = runpref.fit_mode;

	switch (myfitmode)
	{
		case FIT_HEIGHT:
			/* Fit size. */
			h = pp->height;
			w = h * page_ratio;
			scale = h / popheight;
			/* Center page. */
			tx = (pp->width - popwidth * scale) * 0.5;
			ty = 0;
			break;

		case FIT_WIDTH:
			w = pp->width;
			h = w / page_ratio;
			scale = w / popwidth;
			tx = 0;
			ty = (pp->height - popheight * scale) * 0.5;
			break;
	}

	/* A black background on beamer frame. Push and pop cairo contexts, so we have a
	 * clean state afterwards. */
	if (pp->isBeamer) {
	    cairo_save(cr);
	    cairo_set_source_rgb(cr, 0, 0, 0);
	    cairo_rectangle(cr, 0, 0, pp->width, pp->height);
	    cairo_fill(cr);
	    cairo_restore(cr);
	    
	    /* center page on beamer */
	    cairo_translate(cr, tx, ty);
	} else {
	    cairo_translate(cr, tx, 0);
	}

	/* Render the page */
	cairo_scale(cr, scale, scale);
	poppler_page_render(page, cr);

	/* We no longer need that page. */
	g_object_unref(G_OBJECT(page));

	/* Nobody else draws to this widget. */
	return TRUE;
}
Ejemplo n.º 30
0
void finestra(struttura *str)
{
 GtkWidget *frame, *winbox, *box,*table;//nuovo x lista

 GtkWidget **buttonArray;

 int i, x, y;
 char s_i[3];
 /*Definiamo vettore che contiene gli indici delle posizioni possibili dell'interfaccia*/
 char s[NUM_OF_BUTTONS][10]={"1","2 abc","3 def","4 ghi","5 jkl","6 mno","7 pqrs","8 tuv","9 wxyz","⇧ shift","0 +","PT","del","space","↵","sf","tab","ins","→","↓","."};
 /* GDK_GRAVITY_SOUTH_WEST is the reference point corresponding at the lower left corner -> position 1
  GDK_GRAVITY_SOUTH is the reference point corresponding at the middle of the lower edge -> position 2
  GDK_GRAVITY_SOUTH_EAST is the reference point corresponding at the lower right corner -> position 3
*/
 str->window = gtk_window_new (GTK_WINDOW_POPUP);
 gtk_window_set_default_size (GTK_WINDOW(str->window),  WINDOW_WIDTH, WINDOW_HEIGHT);
 
 winbox = gtk_vbox_new (FALSE, 0);
 gtk_container_add (GTK_CONTAINER (str->window), winbox);
 gtk_widget_show (winbox);

 /* Crea una Frame */
 frame = gtk_frame_new(NULL);
 gtk_container_add(GTK_CONTAINER(winbox), frame);
 /* Setta l'etichetta della frame */
 gtk_frame_set_label( GTK_FRAME(frame), "Keyboard" );
 gtk_widget_show (frame);

 box = gtk_vbox_new (FALSE, 0);
 gtk_container_add (GTK_CONTAINER (frame), box);
 gtk_widget_show (box);

 buttonArray = (GtkWidget**)g_malloc((NUM_OF_BUTTONS)*sizeof(GtkButton**));

 table = gtk_table_new(NUM_OF_ROWS, NUM_OF_COLUMNS, TRUE);
 gtk_table_set_row_spacings(GTK_TABLE(table), 1);
 gtk_table_set_col_spacings(GTK_TABLE(table), 1);
 x=y=0; 
 for(i=1; i<=NUM_OF_BUTTONS;i++)
 {  
    buttonArray[i] = gtk_button_new_with_label(s[i-1]);
    gtk_widget_set_size_request(buttonArray[i],60,40);
    gtk_table_attach_defaults(GTK_TABLE(table), buttonArray[i], x, x+1, y, y+1);
    supportoButtonTable(s_i,i);
    gtk_widget_set_name(buttonArray[i],s_i);
    g_signal_connect(G_OBJECT(buttonArray[i]), "clicked", G_CALLBACK(button_clicked),str);
    if(++x==NUM_OF_COLUMNS)
     {
      x=0;
      y++;
     }
  }

 gtk_box_pack_start(GTK_BOX(box), table, FALSE, FALSE, 0);

 /* Crea una Label per i tasti Shift e Ctrl */
 str->mylabel = gtk_label_new ("Shift off");
 gtk_widget_set_usize(str->mylabel, 0, 1);
 gtk_container_add(GTK_CONTAINER(box), str->mylabel);
 gtk_widget_show (str->mylabel);


 
 /* Crea una Lista per il T9 */
 str->tp.gtklist=gtk_list_new();
 gtk_list_set_selection_mode((GtkList *)str->tp.gtklist, GTK_SELECTION_SINGLE);
 str->tp.scrolled_window=gtk_scrolled_window_new(NULL,NULL);
 gtk_widget_set_usize(str->tp.scrolled_window, 0,S_W_MAIN);//75//
 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (str->tp.scrolled_window),GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(str->tp.scrolled_window),str->tp.gtklist);
 gtk_container_add(GTK_CONTAINER(box),str->tp.scrolled_window);
 gtk_widget_show(str->tp.scrolled_window);
 gtk_widget_show(str->tp.gtklist);
 gtk_signal_connect(GTK_OBJECT(str->tp.gtklist),"selection_changed",GTK_SIGNAL_FUNC(sigh_print_selection),str);//nuovo x lista
 

 
 
 /* Crea una Label per il T9 */
 str->mylabel2 = gtk_label_new ("PT off");
 gtk_widget_set_usize(str->mylabel2,0, 1);
 gtk_container_add(GTK_CONTAINER(box),str->mylabel2);
 gtk_widget_show (str->mylabel2);

 /* Crea uno status icon per la minimizzazione */
 str->tray_icon = gtk_status_icon_new();
 g_signal_connect(G_OBJECT(str->tray_icon), "activate",G_CALLBACK(tray_icon_on_click), str);
 gtk_status_icon_set_from_icon_name(str->tray_icon,GTK_STOCK_MEDIA_STOP);
 gtk_status_icon_set_from_file(str->tray_icon,PATH_IMG);
 gtk_status_icon_set_tooltip(str->tray_icon,"Keyboard Tray Icon");
 gtk_status_icon_set_visible(str->tray_icon, FALSE);

 gtk_widget_show_all(str->window);
 /*salviamo le dim massime dello schermo corrente*/
 getMaxScreen(str);
 ins(str);
// gtk_main ();
}