Back to index

lightning-sunbird  0.9+nobinonly
progressui.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


int InitProgressUI (int *argc, char ***argv)
int ShowProgressUI ()
void QuitProgressUI ()
void UpdateProgressUI (float progress)

Function Documentation

int InitProgressUI ( int argc,
char ***  argv 

Definition at line 83 of file progressui_gtk.cpp.

  sProgramPath = (*pargv)[0];

  sEnableUI = gtk_init_check(pargc, pargv);
  return 0;

Here is the caller graph for this function:

Definition at line 152 of file progressui_gtk.cpp.

  sQuit = TRUE;

Here is the caller graph for this function:

Definition at line 92 of file progressui_gtk.cpp.

  if (!sEnableUI)
    return -1;

  // Only show the Progress UI if the process is taking significant time.
  // Here we measure significant time as taking more than one second.


  if (sQuit || sProgressVal > 50.0f)
    return 0;

  char path[PATH_MAX];
  snprintf(path, sizeof(path), "%s.ini", sProgramPath);

  StringTable strings;
  if (ReadStrings(path, &strings) != OK)
    return -1;
  sWin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  if (!sWin)
    return -1;

  // GTK 2.2 seems unable to prevent our dialog from being closed when
  // the user hits the close button on the dialog.  This problem only
  // occurs when either one of the following methods are called:
  //   gtk_window_set_position
  //   gtk_window_set_type_hint
  // For this reason, we disable window decorations.
  g_signal_connect(G_OBJECT(sWin), "delete_event",
                   G_CALLBACK(OnDeleteEvent), NULL);

  gtk_window_set_title(GTK_WINDOW(sWin), strings.title);
  gtk_window_set_type_hint(GTK_WINDOW(sWin), GDK_WINDOW_TYPE_HINT_DIALOG);
  gtk_window_set_position(GTK_WINDOW(sWin), GTK_WIN_POS_CENTER_ALWAYS);
  gtk_window_set_resizable(GTK_WINDOW(sWin), FALSE);
  gtk_window_set_decorated(GTK_WINDOW(sWin), FALSE);

  GtkWidget *vbox = gtk_vbox_new(TRUE, 6);
  sLabel = gtk_label_new(;
  gtk_misc_set_alignment(GTK_MISC(sLabel), 0.0f, 0.0f);
  sProgressBar = gtk_progress_bar_new();

  gtk_box_pack_start(GTK_BOX(vbox), sLabel, FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(vbox), sProgressBar, TRUE, TRUE, 0);

  sTimerID = g_timeout_add(TIMER_INTERVAL, UpdateDialog, NULL);

  gtk_container_set_border_width(GTK_CONTAINER(sWin), 10);
  gtk_container_add(GTK_CONTAINER(sWin), vbox);

  return 0;

Here is the call graph for this function:

Here is the caller graph for this function:

void UpdateProgressUI ( float  progress)

Definition at line 159 of file progressui_gtk.cpp.

  sProgressVal = progress;  // 32-bit writes are atomic

Here is the caller graph for this function: