camera info/manual/about working. doesn't init() at start-up (waits for camera-related function

git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@654 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
Scott Fritzinger
2000-07-11 23:00:35 +00:00
parent 6a86527a53
commit f2352ff9bf
7 changed files with 315 additions and 73 deletions

View File

@@ -4,8 +4,8 @@ INCLUDES = \
-I$(top_srcdir)/intl \
@GTK_CFLAGS@
CFLAGS = @CFLAGS@ `gphoto2-config --cflags`
LDFLAGS = @LDFLAGS@ `gphoto2-config --libs`
CFLAGS = @CFLAGS@ `gphoto2-config --cflags` `gdk-pixbuf-config --cflags`
LDFLAGS = @LDFLAGS@ `gphoto2-config --libs` `gdk-pixbuf-config --libs`
bin_PROGRAMS = gphoto2_gtk

View File

@@ -5,6 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <gtk/gtk.h>
#include <gphoto2.h>
@@ -19,9 +20,63 @@ void debug_print (char *message) {
printf("%s\n", message);
}
void idle() {
/* Let's GTK do some processing */
while (gtk_events_pending())
gtk_main_iteration();
usleep(300000);
while (gtk_events_pending())
gtk_main_iteration();
}
int camera_set() {
/* Takes the settings 'camera', 'port', and 'speed' and
sets it to the current camera */
GtkWidget *message, *message_label;
CameraPortSettings ps;
char camera[1024], port[1024], speed[1024];
/* create a transient window */
message = create_message_window_transient();
message_label = (GtkWidget*) lookup_widget(message, "message");
gtk_label_set_text(GTK_LABEL(message_label), "Initializing camera...");
if (gp_setting_get("camera", camera)==GP_ERROR) {
gp_message("You must choose a camera");
camera_select();
}
gp_setting_get("port", port);
gp_setting_get("speed", speed);
strcpy(ps.path, port);
if (strlen(speed)>0)
ps.speed = atoi(speed);
else
ps.speed = 0; /* use the default speed */
gtk_widget_show_all(message);
idle();
if (gp_camera_set_by_name(camera, &ps)==GP_ERROR) {
gtk_widget_destroy(message);
gp_gtk_camera_init = 0;
return (GP_ERROR);
}
gtk_widget_destroy(message);
gp_gtk_camera_init = 1;
return (GP_OK);
}
int main_quit(GtkWidget *widget, gpointer data) {
gp_exit();
if (gp_gtk_camera_init)
gp_exit();
gtk_main_quit();
return (FALSE);
@@ -139,19 +194,28 @@ void camera_select_update_port(GtkWidget *entry, gpointer data) {
if (strlen(new_port)==0)
return;
sprintf(buf, "Selected port: %s\n", new_port);
sprintf(buf, "Selected port: %s", new_port);
debug_print(buf);
window = (GtkWidget*)data;
speed = (GtkWidget*)lookup_widget(window, "speed");
t = (char*)gtk_object_get_data (GTK_OBJECT(window), new_port);
type = (CameraPortType)atoi(t);
if (!t) {
debug_print("port type not being set");
return;
}
type = (CameraPortType)atoi(t);
sprintf(buf, "%s path", new_port);
path = gtk_object_get_data(GTK_OBJECT(window), buf);
/* Disabled by default */
gtk_widget_set_sensitive(GTK_WIDGET(speed), FALSE);
if (type == GP_PORT_SERIAL)
gtk_widget_set_sensitive(GTK_WIDGET(speed), TRUE);
else
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(speed)->entry), "");
}
void camera_select_update_camera(GtkWidget *entry, gpointer data) {
@@ -173,25 +237,18 @@ void camera_select_update_camera(GtkWidget *entry, gpointer data) {
port = (GtkWidget*)lookup_widget(window, "port");
speed = (GtkWidget*)lookup_widget(window, "speed");
sprintf(buf, "Selected camera: %s\n", new_camera);
sprintf(buf, "Selected camera: %s", new_camera);
debug_print(buf);
if (gp_camera_abilities_by_name(new_camera, &a)==GP_ERROR) {
sprintf(buf, "Could not get abilities for %s\n", new_camera);
sprintf(buf, "Could not get abilities for %s", new_camera);
debug_print(buf);
return;
}
/* Do nothing if the device doesn't support any ports (ports ports) */
if (!a.serial && !a.parallel && !a.ieee1394 && !a.socket && !a.usb)
return;
/* Enable the port drop-down */
gtk_widget_set_sensitive(GTK_WIDGET(port), TRUE);
/* Get the number of ports */
if ((num_ports = gp_port_count())==GP_ERROR) {
gp_interface_message("Could not retrieve number of ports");
gp_message("Could not retrieve number of ports");
return;
}
@@ -215,17 +272,19 @@ void camera_select_update_camera(GtkWidget *entry, gpointer data) {
if (append) {
sprintf(buf, "%s (%s)", info.name, info.path);
port_list = g_list_append(port_list, strdup(buf));
/* Associate a path with this entry */
sprintf(buf1, "%s path", buf);
gtk_object_set_data(GTK_OBJECT(window),
buf1, (gpointer)strdup(info.path));
/* Associate a type with this entry */
sprintf(buf1, "%i", info.type);
gtk_object_set_data(GTK_OBJECT(window),
buf, (gpointer)strdup(buf1));
}
} else {
gp_interface_message("Error retrieving the port list");
gp_message("Error retrieving the port list");
}
}
gtk_combo_set_popdown_strings(GTK_COMBO(port), port_list);
@@ -241,13 +300,15 @@ void camera_select_update_camera(GtkWidget *entry, gpointer data) {
}
gtk_combo_set_popdown_strings(GTK_COMBO(speed), speed_list);
gtk_widget_set_sensitive(GTK_WIDGET(port), FALSE);
gtk_widget_set_sensitive(GTK_WIDGET(speed), FALSE);
if (a.serial || a.parallel || a.ieee1394 || a.socket || a.usb)
gtk_widget_set_sensitive(GTK_WIDGET(port), TRUE);
}
void camera_select() {
GtkWidget *window, *ok, *cancel, *camera, *port, *speed;
GtkWidget *window, *ok, *cancel, *camera, *port, *speed, *label;
GList *camera_list;
CameraPortSettings port_settings;
int num_cameras, x;
char buf[1024];
char *camera_name, *port_name, *port_path, *speed_name;
@@ -256,7 +317,7 @@ void camera_select() {
/* Get the number of cameras */
if ((num_cameras = gp_camera_count())==GP_ERROR) {
gp_interface_message("Could not retrieve number of cameras");
gp_message("Could not retrieve number of cameras");
return;
}
@@ -288,15 +349,23 @@ void camera_select() {
gtk_signal_connect(GTK_OBJECT(GTK_COMBO(port)->entry), "changed",
GTK_SIGNAL_FUNC (camera_select_update_port), (gpointer)window);
if (gp_get_setting("camera", buf)==GP_OK)
gtk_entry_set_text(GTK_ENTRY(camera), buf);
/* Retrieve the saved values */
if (gp_setting_get("camera", buf)==GP_OK)
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(camera)->entry), buf);
if (gp_setting_get("port name", buf)==GP_OK)
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(port)->entry), buf);
if (gp_setting_get("speed", buf)==GP_OK)
gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(speed)->entry), buf);
camera_select_again:
if (wait_for_hide(window, ok, cancel) == 0) {
debug_print("clicked cancel!\n");
debug_print("clicked cancel!");
return;
}
debug_print("clicked ok!\n");
debug_print("clicked ok!");
idle(); /* let GTK catch up */
camera_name = (char*)gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(camera)->entry));
port_name = (char*)gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(port)->entry));
@@ -307,7 +376,7 @@ camera_select_again:
goto camera_select_again;
}
if (strlen(port_name)==0) {
if ((strlen(port_name)==0)&&(GTK_WIDGET_SENSITIVE(port))) {
gp_message("You must choose a port");
goto camera_select_again;
}
@@ -317,72 +386,148 @@ camera_select_again:
goto camera_select_again;
}
sprintf(buf, "%s path", port_name);
port_path = gtk_object_get_data(GTK_OBJECT(window), buf);
gp_setting_set("camera", camera_name);
strcpy(port_settings.path, port_path);
port_settings.speed = atoi(speed_name);
/*
if (gp_camera_set_by_name(
gp_setting_set("camera", (char*)gtk_
*/
/* Set the camera */
/* Set the port */
if (GTK_WIDGET_SENSITIVE(port)) {
sprintf(buf, "%s path", port_name);
port_path = (char*)gtk_object_get_data(GTK_OBJECT(window), buf);
gp_setting_set("port name", port_name);
gp_setting_set("port", port_path);
} else {
gp_setting_set("port name", "");
gp_setting_set("port", "");
}
if (GTK_WIDGET_SENSITIVE(speed))
gp_setting_set("speed", speed_name);
else
gp_setting_set("speed", "");
if (camera_set()==GP_ERROR)
goto camera_select_again;
/* Clean up */
label = (GtkWidget*) lookup_widget(gp_gtk_main_window, "camera_label");
gtk_label_set_text(GTK_LABEL(label), camera_name);
gtk_widget_destroy(window);
}
void camera_index_thumbnails() {
debug_print("camera index thumbnails");
if (!gp_gtk_camera_init)
if (camera_set()==GP_ERROR) {return;}
}
void camera_index_no_thumbnails() {
debug_print("camera index no thumbnails");
if (!gp_gtk_camera_init)
if (camera_set()==GP_ERROR) {return;}
}
void camera_download_thumbnails() {
debug_print("camera download thumbnails");
if (!gp_gtk_camera_init)
if (camera_set()==GP_ERROR) {return;}
}
void camera_download_photos() {
debug_print("camera download photos");
if (!gp_gtk_camera_init)
if (camera_set()==GP_ERROR) {return;}
}
void camera_download_both() {
debug_print("camera download both");
if (!gp_gtk_camera_init)
if (camera_set()==GP_ERROR) {return;}
}
void camera_delete_selected() {
debug_print("camera delete selected");
if (!gp_gtk_camera_init)
if (camera_set()==GP_ERROR) {return;}
}
void camera_delete_all() {
debug_print("camera delete all");
if (!gp_gtk_camera_init)
if (camera_set()==GP_ERROR) {return;}
}
void camera_configure() {
debug_print("camera configure");
if (!gp_gtk_camera_init)
if (camera_set()==GP_ERROR) {return;}
}
void camera_show_information() {
char buf[1024*32];
debug_print("camera information");
if (!gp_gtk_camera_init)
if (camera_set()==GP_ERROR) {return;}
if (gp_summary(buf)==GP_ERROR) {
gp_message("Could not retrieve camera information");
return;
}
gp_message(buf);
}
void camera_show_manual() {
char buf[1024*32];
debug_print("camera manual");
if (!gp_gtk_camera_init)
if (camera_set()==GP_ERROR) {return;}
if (gp_manual(buf)==GP_ERROR) {
gp_message("Could not retrieve the camera manual");
return;
}
gp_message(buf);
}
void camera_show_about() {
char buf[1024*32];
debug_print("camera about");
if (!gp_gtk_camera_init)
if (camera_set()==GP_ERROR) {return;}
if (gp_about(buf)==GP_ERROR) {
gp_message("Could not retrieve library information");
return;
}
gp_message(buf);
}

View File

@@ -1,3 +1,4 @@
extern GtkWidget *main_window;
extern GtkWidget *gp_gtk_main_window;
extern int gp_gtk_debug;
extern int gp_gtk_camera_init;
extern char gp_gtk_camera_model[];

View File

@@ -20,10 +20,28 @@
#include "support.h"
#include "util.h"
/* Not in gphoto API */
int gp_interface_message_long(char *message) {
GtkWidget *window, *ok, *text;
char buf[1024*32];
window = create_message_window_long();
text = (GtkWidget*) lookup_widget(window, "message");
ok = (GtkWidget*) lookup_widget(window, "close");
gtk_text_insert(GTK_TEXT(text),NULL,NULL,NULL,buf,strlen(buf));
wait_for_hide(window, ok, NULL);
return (GP_OK);
}
int gp_interface_message(char *message) {
GtkWidget *window, *label, *ok;
if (strlen(message) > 1024)
gp_interface_message_long(message);
window = create_message_window();
label = (GtkWidget*) lookup_widget(window, "message");
ok = (GtkWidget*) lookup_widget(window, "close");
@@ -54,8 +72,15 @@ int gp_interface_confirm(char *message) {
GtkWidget*
create_main_window (void)
{
/* __main */
/* widget labels: "camera_label" "camera_tree" "progress bar" "thumbnail_table"
"status_bar" "notebook"
*/
GtkWidget *main_window;
GtkWidget *vbox1;
GtkWidget *notebook;
GtkWidget *label;
GtkWidget *menubar1;
guint tmp_key;
GtkWidget *file2;
@@ -161,7 +186,6 @@ create_main_window (void)
GtkWidget *exit_button;
GtkWidget *hpaned1;
GtkWidget *vbox2;
GtkWidget *camera_model_label;
GtkWidget *scrolledwindow1;
GtkWidget *viewport1;
GtkWidget *tree1;
@@ -1124,12 +1148,26 @@ create_main_window (void)
GTK_SIGNAL_FUNC(main_quit), NULL);
gtk_widget_show (exit_button);
notebook = gtk_notebook_new();
gtk_widget_ref (notebook);
gtk_object_set_data_full (GTK_OBJECT (main_window), "notebook", notebook,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (notebook);
gtk_box_pack_start (GTK_BOX (vbox1), notebook, TRUE, TRUE, 0);
label = gtk_label_new("Index");
gtk_widget_ref (label);
gtk_object_set_data_full (GTK_OBJECT (main_window), "label", label,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label);
hpaned1 = gtk_hpaned_new ();
gtk_widget_ref (hpaned1);
gtk_object_set_data_full (GTK_OBJECT (main_window), "hpaned1", hpaned1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hpaned1);
gtk_box_pack_start (GTK_BOX (vbox1), hpaned1, TRUE, TRUE, 0);
gtk_notebook_append_page(GTK_NOTEBOOK(notebook), hpaned1, label);
// gtk_box_pack_start (GTK_BOX (vbox1), hpaned1, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (hpaned1), 2);
gtk_paned_set_position (GTK_PANED (hpaned1), 200);
@@ -1140,16 +1178,7 @@ create_main_window (void)
gtk_widget_show (vbox2);
gtk_paned_pack1 (GTK_PANED (hpaned1), vbox2, FALSE, TRUE);
camera_model_label = gtk_label_new (_("No Camera Selected"));
gtk_widget_ref (camera_model_label);
gtk_object_set_data_full (GTK_OBJECT (main_window), "camera_model_label", camera_model_label,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (camera_model_label);
gtk_box_pack_start (GTK_BOX (vbox2), camera_model_label, FALSE, FALSE, 0);
gtk_label_set_justify (GTK_LABEL (camera_model_label), GTK_JUSTIFY_LEFT);
gtk_misc_set_alignment (GTK_MISC (camera_model_label), 0, 0.5);
gtk_misc_set_padding (GTK_MISC (camera_model_label), 0, 5);
/* __main */
scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_ref (scrolledwindow1);
gtk_object_set_data_full (GTK_OBJECT (main_window), "scrolledwindow1", scrolledwindow1,
@@ -1167,7 +1196,7 @@ create_main_window (void)
tree1 = gtk_tree_new ();
gtk_widget_ref (tree1);
gtk_object_set_data_full (GTK_OBJECT (main_window), "tree1", tree1,
gtk_object_set_data_full (GTK_OBJECT (main_window), "camera_tree", tree1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (tree1);
gtk_container_add (GTK_CONTAINER (viewport1), tree1);
@@ -1196,7 +1225,7 @@ create_main_window (void)
table1 = gtk_table_new (100, 5, FALSE);
gtk_widget_ref (table1);
gtk_object_set_data_full (GTK_OBJECT (main_window), "table1", table1,
gtk_object_set_data_full (GTK_OBJECT (main_window), "thumbnail_table", table1,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (table1);
gtk_container_add (GTK_CONTAINER (viewport2), table1);
@@ -1327,7 +1356,7 @@ create_message_window_long (void)
GtkWidget *vbox3;
GtkWidget *scrolledwindow4;
GtkWidget *message_window_text;
GtkWidget *hbox1;
GtkWidget *hsep;
GtkWidget *message_window_close;
message_window_long = gtk_window_new (GTK_WINDOW_DIALOG);
@@ -1336,6 +1365,7 @@ create_message_window_long (void)
gtk_window_set_position (GTK_WINDOW (message_window_long), GTK_WIN_POS_CENTER);
gtk_window_set_modal (GTK_WINDOW (message_window_long), TRUE);
gtk_window_set_default_size (GTK_WINDOW (message_window_long), 400, 400);
gtk_container_set_border_width (GTK_CONTAINER (message_window_long), 5);
vbox3 = gtk_vbox_new (FALSE, 0);
gtk_widget_ref (vbox3);
@@ -1357,21 +1387,22 @@ create_message_window_long (void)
gtk_object_set_data_full (GTK_OBJECT (message_window_long), "message", message_window_text,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (message_window_text);
gtk_text_set_editable(GTK_TEXT(message_window_text), FALSE);
gtk_container_add (GTK_CONTAINER (scrolledwindow4), message_window_text);
hbox1 = gtk_hbox_new (TRUE, 0);
gtk_widget_ref (hbox1);
gtk_object_set_data_full (GTK_OBJECT (message_window_long), "hbox1", hbox1,
hsep = gtk_hseparator_new();
gtk_widget_ref (hsep);
gtk_object_set_data_full (GTK_OBJECT (message_window_long), "hsep", hsep,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbox1);
gtk_box_pack_start (GTK_BOX (vbox3), hbox1, FALSE, FALSE, 0);
gtk_widget_show (hsep);
gtk_box_pack_start (GTK_BOX (vbox3), hsep, FALSE, FALSE, 0);
message_window_close = gtk_button_new_with_label (_(" Close "));
gtk_widget_ref (message_window_close);
gtk_object_set_data_full (GTK_OBJECT (message_window_long), "close", message_window_close,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (message_window_close);
gtk_box_pack_start (GTK_BOX (hbox1), message_window_close, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox3), message_window_close, FALSE, FALSE, 0);
return message_window_long;
}
@@ -1387,6 +1418,7 @@ create_confirm_window (void)
GtkWidget *hbox2;
GtkWidget *button19;
GtkWidget *button20;
GtkWidget *hsep;
confirm_window = gtk_window_new (GTK_WINDOW_DIALOG);
gtk_object_set_data (GTK_OBJECT (confirm_window), "confirm_window", confirm_window);
@@ -1394,6 +1426,7 @@ create_confirm_window (void)
gtk_window_set_position (GTK_WINDOW (confirm_window), GTK_WIN_POS_CENTER);
gtk_window_set_modal (GTK_WINDOW (confirm_window), TRUE);
gtk_window_set_default_size (GTK_WINDOW (confirm_window), 350, 200);
gtk_container_set_border_width (GTK_CONTAINER (confirm_window), 5);
vbox4 = gtk_vbox_new (FALSE, 7);
gtk_widget_ref (vbox4);
@@ -1409,6 +1442,13 @@ create_confirm_window (void)
gtk_widget_show (confirm_label);
gtk_box_pack_start (GTK_BOX (vbox4), confirm_label, TRUE, TRUE, 0);
hsep = gtk_hseparator_new();
gtk_widget_ref (hsep);
gtk_object_set_data_full (GTK_OBJECT (confirm_window), "hsep", hsep,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hsep);
gtk_box_pack_start (GTK_BOX (vbox4), hsep, FALSE, FALSE, 0);
hbox2 = gtk_hbox_new (TRUE, 5);
gtk_widget_ref (hbox2);
gtk_object_set_data_full (GTK_OBJECT (confirm_window), "hbox2", hbox2,
@@ -1441,8 +1481,8 @@ create_message_window (void)
GtkWidget *message_window;
GtkWidget *vbox5;
GtkWidget *label8;
GtkWidget *hbox3;
GtkWidget *button21;
GtkWidget *hsep;
message_window = gtk_window_new (GTK_WINDOW_DIALOG);
gtk_object_set_data (GTK_OBJECT (message_window), "message_window", message_window);
@@ -1450,6 +1490,7 @@ create_message_window (void)
gtk_window_set_position (GTK_WINDOW (message_window), GTK_WIN_POS_CENTER);
gtk_window_set_modal (GTK_WINDOW (message_window), TRUE);
gtk_window_set_default_size (GTK_WINDOW (message_window), 350, 200);
gtk_container_set_border_width (GTK_CONTAINER (message_window), 5);
vbox5 = gtk_vbox_new (FALSE, 0);
gtk_widget_ref (vbox5);
@@ -1466,19 +1507,53 @@ create_message_window (void)
gtk_box_pack_start (GTK_BOX (vbox5), label8, TRUE, TRUE, 0);
gtk_label_set_line_wrap (GTK_LABEL (label8), TRUE);
hbox3 = gtk_hbox_new (TRUE, 0);
gtk_widget_ref (hbox3);
gtk_object_set_data_full (GTK_OBJECT (message_window), "hbox3", hbox3,
hsep = gtk_hseparator_new();
gtk_widget_ref (hsep);
gtk_object_set_data_full (GTK_OBJECT (message_window), "hsep", hsep,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbox3);
gtk_box_pack_start (GTK_BOX (vbox5), hbox3, FALSE, FALSE, 0);
gtk_widget_show (hsep);
gtk_box_pack_start (GTK_BOX (vbox5), hsep, FALSE, FALSE, 0);
button21 = gtk_button_new_with_label (_(" Close "));
gtk_widget_ref (button21);
gtk_object_set_data_full (GTK_OBJECT (message_window), "close", button21,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (button21);
gtk_box_pack_start (GTK_BOX (hbox3), button21, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox5), button21, FALSE, FALSE, 0);
return message_window;
}
GtkWidget*
create_message_window_transient (void)
{
/* widget labels: "message" */
GtkWidget *message_window;
GtkWidget *vbox5;
GtkWidget *label8;
message_window = gtk_window_new (GTK_WINDOW_DIALOG);
gtk_object_set_data (GTK_OBJECT (message_window), "message_window", message_window);
gtk_window_set_title (GTK_WINDOW (message_window), _("gPhoto2 Message"));
gtk_window_set_position (GTK_WINDOW (message_window), GTK_WIN_POS_CENTER);
gtk_window_set_modal (GTK_WINDOW (message_window), TRUE);
gtk_window_set_default_size (GTK_WINDOW (message_window), 250, 100);
gtk_container_set_border_width (GTK_CONTAINER (message_window), 5);
vbox5 = gtk_vbox_new (FALSE, 0);
gtk_widget_ref (vbox5);
gtk_object_set_data_full (GTK_OBJECT (message_window), "vbox5", vbox5,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (vbox5);
gtk_container_add (GTK_CONTAINER (message_window), vbox5);
label8 = gtk_label_new (_("No message."));
gtk_widget_ref (label8);
gtk_object_set_data_full (GTK_OBJECT (message_window), "message", label8,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label8);
gtk_box_pack_start (GTK_BOX (vbox5), label8, TRUE, TRUE, 0);
gtk_label_set_line_wrap (GTK_LABEL (label8), TRUE);
return message_window;
}
@@ -1512,6 +1587,7 @@ create_select_camera_window (void)
gtk_window_set_position (GTK_WINDOW (select_camera_window), GTK_WIN_POS_CENTER);
gtk_window_set_modal (GTK_WINDOW (select_camera_window), TRUE);
gtk_window_set_default_size (GTK_WINDOW (select_camera_window), 300, 150);
gtk_container_set_border_width(GTK_CONTAINER(select_camera_window), 5);
vbox6 = gtk_vbox_new (FALSE, 0);
gtk_widget_ref (vbox6);
@@ -1547,6 +1623,7 @@ create_select_camera_window (void)
gtk_object_set_data_full (GTK_OBJECT (select_camera_window), "camera", camera_combo,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (camera_combo);
gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(camera_combo)->entry), FALSE);
gtk_box_pack_start (GTK_BOX (vbox7), camera_combo, FALSE, FALSE, 0);
combo_entry1 = GTK_COMBO (camera_combo)->entry;
@@ -1572,6 +1649,7 @@ create_select_camera_window (void)
port_combo = gtk_combo_new ();
gtk_widget_ref (port_combo);
gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(port_combo)->entry), FALSE);
gtk_object_set_data_full (GTK_OBJECT (select_camera_window), "port", port_combo,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (port_combo);
@@ -1593,6 +1671,7 @@ create_select_camera_window (void)
speed_combo = gtk_combo_new ();
gtk_widget_ref (speed_combo);
gtk_entry_set_editable(GTK_ENTRY(GTK_COMBO(speed_combo)->entry), FALSE);
gtk_object_set_data_full (GTK_OBJECT (select_camera_window), "speed", speed_combo,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (speed_combo);

View File

@@ -3,9 +3,10 @@
*/
GtkWidget* create_main_window (void);
GtkWidget* create_message_window_long (void);
GtkWidget* create_confirm_window (void);
GtkWidget* create_message_window (void);
GtkWidget* create_message_window_long (void);
GtkWidget* create_message_window_transient (void);
GtkWidget* create_select_camera_window (void);
int gp_interface_message(char *message);

View File

@@ -14,13 +14,15 @@
#include "interface.h"
#include "support.h"
GtkWidget *main_window;
int gp_gtk_debug=1;
GtkWidget *gp_gtk_main_window;
int gp_gtk_debug;
char gp_gtk_camera_model[1024];
int gp_gtk_camera_init=0;
int
main (int argc, char *argv[])
{
char buf[1024];
#ifdef ENABLE_NLS
bindtextdomain (PACKAGE, PACKAGE_LOCALE_DIR);
@@ -29,7 +31,17 @@ main (int argc, char *argv[])
gtk_set_locale ();
gtk_init (&argc, &argv);
gp_init();
if (argc > 1) {
if (strcmp(argv[1], "-d")==0)
gp_gtk_debug = 1;
else
gp_gtk_debug = 0;
}
gp_debug_set(gp_gtk_debug);
gp_init();
add_pixmap_directory (PACKAGE_DATA_DIR "/pixmaps");
add_pixmap_directory (PACKAGE_SOURCE_DIR "/pixmaps");
@@ -39,10 +51,14 @@ main (int argc, char *argv[])
* (except popup menus), just so that you see something after building
* the project. Delete any components that you don't want shown initially.
*/
main_window = create_main_window ();
gtk_widget_show (main_window);
gtk_signal_connect (GTK_OBJECT(main_window), "delete_event",
gp_gtk_main_window = create_main_window ();
gtk_widget_show (gp_gtk_main_window);
if (gp_setting_get("camera", buf)==GP_OK) {
/* Set the camera model label */
}
gtk_signal_connect (GTK_OBJECT(gp_gtk_main_window), "delete_event",
GTK_SIGNAL_FUNC(main_quit), NULL);
gtk_main ();

View File

@@ -29,7 +29,7 @@ int wait_for_hide (GtkWidget *dialog,
"clicked",
GTK_SIGNAL_FUNC(gtk_widget_hide),
GTK_OBJECT(dialog));
gtk_widget_show(dialog);
gtk_widget_show_all(dialog);
while (cont) {
/* because the window manager could destroy the window */
if(!GTK_IS_OBJECT(dialog))