Exemple #1
0
/* fills [applet->w_monitor] with entrys for each monitor */
static int
fill_monitor_combo (DdccApplet *applet)
{
	struct monitorlist* monlist;
	struct monitorlist* current;
	char buffer[256];
	
	if (!(monlist = ddcci_load_list ()))
		return 0;
	
	gtk_list_store_clear ( GTK_LIST_STORE ( gtk_combo_box_get_model (
			GTK_COMBO_BOX (applet->w_properties_monitor))));
	
	for (current = monlist; current; current = current->next) {
		snprintf (buffer,
			256,
			"%s: %s",
			current->filename,
			current->name);
		gtk_combo_box_append_text (GTK_COMBO_BOX (
						applet->w_properties_monitor),
					   buffer);
	}

	gtk_combo_box_set_active (
			GTK_COMBO_BOX (applet->w_properties_monitor), 0);

	ddcci_free_list (monlist);

	return 1;
}
Exemple #2
0
static void probe_monitors(GtkWidget *widget, gpointer data) {
	if (combo_box_changed_handler_id)
		g_signal_handler_disconnect(G_OBJECT(combo_box), combo_box_changed_handler_id);
	
	gtk_list_store_clear(GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(combo_box))));
	
	set_message(_(
	"Probing for available monitors..."
		   ));
	
	if (widget == NULL)
		monlist = ddcci_load_list();
	else
		monlist = NULL;
		
	if (!monlist) {
		monlist = ddcci_probe();
	
		ddcci_save_list(monlist);
	}
	
	struct monitorlist* current;
	
	char buffer[256];
	
	for (current = monlist; current != NULL; current = current->next)
	{
		snprintf(buffer, 256, "%s: %s",
			current->filename, current->name);
		gtk_combo_box_append_text(GTK_COMBO_BOX(combo_box), buffer);
	}
	
	combo_box_changed_handler_id = g_signal_connect(G_OBJECT(combo_box), "changed", G_CALLBACK(combo_change), NULL);
	
	currentid = -1;
	nextid = -1;
	
	if (monlist) {
		widgets_set_sensitive(TRUE);
		gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), 0);
	}
	else {
		widgets_set_sensitive(FALSE);
		gtk_widget_set_sensitive(close_button, TRUE);
		gtk_widget_set_sensitive(refresh_controls_button, TRUE);
		set_message(_(
			"No monitor supporting DDC/CI available.\n\n"
			"If your graphics card need it, please check all the required kernel modules are loaded (i2c-dev, and your framebuffer driver)."
			   ));
	}
}