// Start starts the dock theme and apply last settings. // func (settings *DockSettings) Start() { //\___________________ handle crashes. // if (! bTesting) // _cairo_dock_set_signal_interception (); //\___________________ handle terminate signals to quit properly (especially when the system shuts down). // signal (SIGTERM, _cairo_dock_quit); // Term // kill -15 (system) // signal (SIGHUP, _cairo_dock_quit); // sent to a process when its controlling terminal is closed // MISSING //\___________________ Disable modules that have crashed //\___________________ maintenance mode -> show the main config panel. // Copy the default theme if needed. if !files.IsExist(globals.ConfigFile()) { createConfigDir(settings) } // MISSING // The first time the Cairo-Dock session is used but not the first time the dock is launched: propose to use the Default-Panel theme // s_bCDSessionLaunched => settings.sessionWasUsed gldi.CurrentThemeLoad() // was moved before registration when I had some problems with refresh on start. Removed here for now. //\___________________ lock mode. if settings.Locked { println("Cairo-Dock will be locked.") // was cd_warning (so it was set just before Verbosity). TODO: improve // As the config window shouldn't be opened, those settings won't change. current.Docks.LockIcons(true) current.Docks.LockAll(true) globals.FullLock = true } if !settings.SafeMode && gldi.ModulesGetNb() <= 1 { // 1 including Help. dialogNoPlugins() } if settings.isNewVersion { // update the version in the file. updateHiddenFile("last version", globals.Version()) // If any operation must be done on the user theme (like activating // a module by default, or disabling an option), it should be done // here once (when CAIRO_DOCK_VERSION matches the new version). } //\___________________ display the changelog in case of a new version. if settings.isFirstLaunch { // first launch => set up config time.AfterFunc(4*time.Second, firstLaunchSetup) } else if settings.isNewVersion { // new version -> changelog (if it's the first launch, useless to display what's new, we already have the Welcome message). dialogChangelog() // In case something has changed in Compiz/Gtk/others, we also run the script on a new version of the dock. time.AfterFunc(4*time.Second, firstLaunchSetup) } // else if (cExcludeModule != NULL && ! bMaintenance && s_iNbCrashes > 1) { // gchar *cMessage; // if (s_iNbCrashes == 2) // <=> second crash: display a dialogue // cMessage = g_strdup_printf (_("The module '%s' may have encountered a problem.\nIt has been restored successfully, but if it happens again, please report it at http://glx-dock.org"), cExcludeModule); // else // since the 3th crash: the applet has been disabled // cMessage = g_strdup_printf (_("The module '%s' has been deactivated because it may have caused some problems.\nYou can reactivate it, if it happens again thanks to report it at http://glx-dock.org"), cExcludeModule); // GldiModule *pModule = gldi_module_get (cExcludeModule); // Icon *icon = gldi_icons_get_any_without_dialog (); // gldi_dialog_show_temporary_with_icon (cMessage, icon, CAIRO_CONTAINER (g_pMainDock), 15000., (pModule ? pModule->pVisitCard->cIconFilePath : NULL)); // g_free (cMessage); // } // if (! bTesting) // g_timeout_add_seconds (5, _cairo_dock_successful_launch, GINT_TO_POINTER (bFirstLaunch)); }
// CurrentThemeLoad imports and loads a dock theme. // func (Data) CurrentThemeLoad(themeName string, useBehaviour, useLaunchers bool) error { // if (pThemesWidget->pImportTask != NULL) // { // gldi_task_discard (pThemesWidget->pImportTask); // pThemesWidget->pImportTask = NULL; // } // //\___________________ On regarde si le theme courant est modifie. // gboolean bNeedSave = cairo_dock_current_theme_need_save (); // if (bNeedSave) // { if gldi.CurrentThemeNeedSave() { // Icon *pIcon = cairo_dock_get_current_active_icon (); // it's most probably the icon corresponding to the configuration window // if (pIcon == NULL || cairo_dock_get_icon_container (pIcon) == NULL) // if not available, get any icon // pIcon = gldi_icons_get_any_without_dialog (); // int iClickedButton = gldi_dialog_show_and_wait (_("You have made some changes to the current theme.\nYou will lose them if you don't save before choosing a new theme. Continue anyway?"), // pIcon, CAIRO_CONTAINER (g_pMainDock), // CAIRO_DOCK_SHARE_DATA_DIR"/"CAIRO_DOCK_ICON, NULL); // if (iClickedButton != 0 && iClickedButton != -1) // cancel button or Escape. // { // return FALSE; // } } // //\___________________ On charge le nouveau theme choisi. // gchar *tmp = g_strdup (cNewThemeName); // CairoDockPackageType iType = cairo_dock_extract_package_type_from_name (tmp); // g_free (tmp); // gboolean bThemeImported = FALSE; // if (iType != CAIRO_DOCK_LOCAL_PACKAGE && iType != CAIRO_DOCK_USER_PACKAGE) // { // GtkWidget *pWaitingDialog = gtk_window_new (GTK_WINDOW_TOPLEVEL); // pThemesWidget->pWaitingDialog = pWaitingDialog; // gtk_window_set_decorated (GTK_WINDOW (pWaitingDialog), FALSE); // gtk_window_set_skip_taskbar_hint (GTK_WINDOW (pWaitingDialog), TRUE); // gtk_window_set_skip_pager_hint (GTK_WINDOW (pWaitingDialog), TRUE); // gtk_window_set_transient_for (GTK_WINDOW (pWaitingDialog), pMainWindow); // gtk_window_set_modal (GTK_WINDOW (pWaitingDialog), TRUE); // GtkWidget *pMainVBox = gtk_box_new (GTK_ORIENTATION_VERTICAL, CAIRO_DOCK_FRAME_MARGIN); // gtk_container_add (GTK_CONTAINER (pWaitingDialog), pMainVBox); // GtkWidget *pLabel = gtk_label_new (_("Please wait while importing the theme...")); // gtk_box_pack_start(GTK_BOX (pMainVBox), pLabel, FALSE, FALSE, 0); // GtkWidget *pBar = gtk_progress_bar_new (); // gtk_progress_bar_pulse (GTK_PROGRESS_BAR (pBar)); // gtk_box_pack_start (GTK_BOX (pMainVBox), pBar, FALSE, FALSE, 0); // pThemesWidget->iSidPulse = g_timeout_add (100, (GSourceFunc)_pulse_bar, pBar); // g_signal_connect (G_OBJECT (pWaitingDialog), // "destroy", // G_CALLBACK (on_waiting_dialog_destroyed), // pThemesWidget); // GtkWidget *pCancelButton = gtk_button_new_with_label (_("Cancel")); // g_signal_connect (G_OBJECT (pCancelButton), "clicked", G_CALLBACK(on_cancel_dl), pWaitingDialog); // gtk_box_pack_start (GTK_BOX (pMainVBox), pCancelButton, FALSE, FALSE, 0); // gtk_widget_show_all (pWaitingDialog); // cd_debug ("start importation..."); // pThemesWidget->pImportTask = cairo_dock_import_theme_async (cNewThemeName, bLoadBehavior, bLoadLaunchers, (GFunc)_load_theme, pThemesWidget); // if 'pThemesWidget' is destroyed, the 'reset' callback will be called and will cancel the task. // } // else // if the theme is already local and uptodate, there is really no need to show a progressbar, because only the download/unpacking is done asynchonously (and the copy of the files is fast enough). // { e := gldi.CurrentThemeImport(themeName, useBehaviour, useLaunchers) if e != nil { return e } gldi.CurrentThemeLoad() return nil }