Skip to content

Commit

Permalink
update icon, use it on all dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
hurzl committed Feb 5, 2013
1 parent e942e59 commit c358b5a
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 57 deletions.
93 changes: 41 additions & 52 deletions src/repsnapper-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 1 addition & 4 deletions src/repsnapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,10 +310,7 @@ int main(int argc, char **argv)
mainwin->setNonPrintingMode(nonprintingmode, opts.gcode_output_path);

Glib::RefPtr<Gio::File> iconfile = find_global_config("repsnapper-icon.svg");
if (iconfile)
mainwin->set_icon_from_file(iconfile->get_path());
else
mainwin->set_icon_name("gtk-convert");
mainwin->set_icon_file(iconfile);
mainwin->set_title("Repsnapper");

if (opts.stl_input_path.size() > 0) {
Expand Down
1 change: 1 addition & 0 deletions src/ui/prefs_dlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class PrefsDlg {
PrefsDlg(Model *model, Glib::RefPtr<Gtk::Builder> &builder);
~PrefsDlg();
void show();
void set_icon_from_file(const string path) {m_preferences_dlg->set_icon_from_file(path);}
};

#endif // SETTINGS_H
16 changes: 15 additions & 1 deletion src/ui/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,17 @@ void View::hide_on_response(int, Gtk::Dialog *dialog)
dialog->hide();
}

void View::set_icon_file(Glib::RefPtr<Gio::File> file)
{
iconfile = file;
if (iconfile) {
set_icon_from_file(iconfile->get_path());
m_settings_ui->set_icon_from_file(iconfile->get_path());
} else
set_icon_name("gtk-convert");
}


void View::show_dialog(const char *name)
{
Gtk::Dialog *dialog;
Expand All @@ -599,7 +610,10 @@ void View::show_dialog(const char *name)
cerr << "no such dialog " << name << "\n";
return;
}
dialog->set_icon_name("gtk-convert");
if (iconfile)
dialog->set_icon_from_file(iconfile->get_path());
else
dialog->set_icon_name("gtk-convert");
dialog->signal_response().connect (sigc::bind(sigc::mem_fun(*this, &View::hide_on_response), dialog));
dialog->show();
// dialog->set_transient_for (*this);
Expand Down
3 changes: 3 additions & 0 deletions src/ui/view.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ class View : public Gtk::Window

Glib::Mutex mutex;

Glib::RefPtr<Gio::File> iconfile;
void set_icon_file(Glib::RefPtr<Gio::File> iconfile);

};

#ifdef MODEL_IMPLEMENTATION
Expand Down

0 comments on commit c358b5a

Please sign in to comment.