static void clicked_hook(GtkLinkButton* button, const char*, void*) { for (GSList* p = gs_hyperlinkctrl_list; p; p = p->next) { wxHyperlinkCtrl* win = static_cast<wxHyperlinkCtrl*>(p->data); if (win->m_widget == (GtkWidget*)button) { win->SetVisited(true); win->SendEvent(); return; } } gtk_link_button_set_uri_hook(NULL, NULL, NULL); GTK_BUTTON_GET_CLASS(button)->clicked(GTK_BUTTON(button)); gtk_link_button_set_uri_hook(clicked_hook, NULL, NULL); }
static VALUE lb_set_uri_hook(VALUE self) { VALUE func = rb_block_proc(); G_RELATIVE(self, func); gtk_link_button_set_uri_hook((GtkLinkButtonUriFunc)link_func, (gpointer)func, (GDestroyNotify)NULL); return self; }
bool wxHyperlinkCtrl::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxString& url, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { if ( UseNative() ) { // do validation checks: CheckParams(label, url, style); if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { wxFAIL_MSG( wxT("wxHyperlinkCtrl creation failed") ); return false; } m_widget = gtk_link_button_new("asdfsaf asdfdsaf asdfdsa"); g_object_ref(m_widget); // alignment float x_alignment = 0.5; if (HasFlag(wxHL_ALIGN_LEFT)) x_alignment = 0.0; else if (HasFlag(wxHL_ALIGN_RIGHT)) x_alignment = 1.0; gtk_button_set_alignment(GTK_BUTTON(m_widget), x_alignment, 0.5); // set to non empty strings both the url and the label SetURL(url.empty() ? label : url); SetLabel(label.empty() ? url : label); #ifdef __WXGTK3__ g_signal_connect(m_widget, "activate_link", G_CALLBACK(activate_link), this); #else gs_hyperlinkctrl_list = g_slist_prepend(gs_hyperlinkctrl_list, this); gtk_link_button_set_uri_hook(clicked_hook, NULL, NULL); #endif m_parent->DoAddChild( this ); PostCreation(size); // wxWindowGTK will connect to the enter_notify and leave_notify GTK+ signals // thus overriding GTK+'s internal signal handlers which set the cursor of // the widget - thus we need to manually set it here: SetCursor(wxCursor(wxCURSOR_HAND)); } else return wxGenericHyperlinkCtrl::Create(parent, id, label, url, pos, size, style, name); return true; }
int main (int argc, char **argv) { gboolean ret; g_thread_init (NULL); gitg_debug_init (); bindtextdomain (GETTEXT_PACKAGE, GITG_LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); g_set_prgname ("gitg"); /* Translators: this is the application name as in g_set_application_name */ g_set_application_name (_("gitg")); gitg_dirs_initialize (argc, argv); gtk_init (&argc, &argv); parse_options (&argc, &argv); set_language_search_path (); set_style_scheme_search_path (); set_icons (); GitgSettings *settings = gitg_settings_get_default (); GitgWindow *window = build_ui (); ret = gitg_window_load_repository_for_command_line (window, argc - 1, (gchar const **)argv + 1, select_sha1); if (commit_mode && ret) { gitg_window_show_commit (window); } original_link_button_hook = gtk_link_button_set_uri_hook ((GtkLinkButtonUriFunc)link_button_uri_hook, window, NULL); gtk_main (); /* Finalize settings */ g_object_unref (settings); return 0; }