mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-04-01 02:00:19 +00:00
Compare commits
5 Commits
e2bfc9b7c9
...
0eb4d08daa
| Author | SHA1 | Date | |
|---|---|---|---|
| 0eb4d08daa | |||
|
|
4b365132ce | ||
| a5ff902ae2 | |||
| bd874540bb | |||
| f6e1af5701 |
@@ -1905,8 +1905,18 @@ menu_metres_both (GtkWidget *item, gpointer none)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
about_dialog_close (GtkDialog *dialog, int response, gpointer data)
|
about_dialog_response (GtkDialog *dialog, int response, gpointer data)
|
||||||
{
|
{
|
||||||
|
if (response == GTK_RESPONSE_HELP)
|
||||||
|
{
|
||||||
|
fe_open_url ("http://zoitechat.zoite.net");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (response == GTK_RESPONSE_APPLY)
|
||||||
|
{
|
||||||
|
fe_open_url ("https://www.gnu.org/licenses/old-licenses/gpl-2.0.html");
|
||||||
|
return;
|
||||||
|
}
|
||||||
gtk_widget_destroy (GTK_WIDGET(dialog));
|
gtk_widget_destroy (GTK_WIDGET(dialog));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1917,45 +1927,16 @@ about_dialog_openurl (GtkAboutDialog *dialog, char *uri, gpointer data)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
about_dialog_button_openurl (GtkButton *button, gpointer data)
|
|
||||||
{
|
|
||||||
fe_open_url ((const char *)data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
about_dialog_add_links (GtkAboutDialog *dialog)
|
|
||||||
{
|
|
||||||
GtkWidget *actions = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
|
|
||||||
GtkWidget *website = gtk_button_new_with_label ("Website");
|
|
||||||
GtkWidget *license = gtk_button_new_with_label ("License");
|
|
||||||
|
|
||||||
g_signal_connect (G_OBJECT (website), "clicked", G_CALLBACK (about_dialog_button_openurl), "http://zoitechat.zoite.net");
|
|
||||||
g_signal_connect (G_OBJECT (license), "clicked", G_CALLBACK (about_dialog_button_openurl), "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html");
|
|
||||||
gtk_box_pack_start (GTK_BOX (actions), website, FALSE, FALSE, 0);
|
|
||||||
gtk_box_pack_start (GTK_BOX (actions), license, FALSE, FALSE, 0);
|
|
||||||
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (actions), website, TRUE);
|
|
||||||
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (actions), license, TRUE);
|
|
||||||
gtk_widget_show_all (actions);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
about_dialog_strip_actions (GtkDialog *dialog)
|
|
||||||
{
|
|
||||||
GtkWidget *area = gtk_dialog_get_action_area (dialog);
|
|
||||||
GList *children = gtk_container_get_children (GTK_CONTAINER (area));
|
|
||||||
GList *node;
|
|
||||||
|
|
||||||
for (node = children; node != NULL; node = node->next)
|
|
||||||
gtk_widget_destroy (GTK_WIDGET (node->data));
|
|
||||||
|
|
||||||
g_list_free (children);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
menu_about (GtkWidget *wid, gpointer sess)
|
menu_about (GtkWidget *wid, gpointer sess)
|
||||||
{
|
{
|
||||||
GtkAboutDialog *dialog = GTK_ABOUT_DIALOG(gtk_about_dialog_new());
|
GtkAboutDialog *dialog = GTK_ABOUT_DIALOG (g_object_new (GTK_TYPE_ABOUT_DIALOG, "use-header-bar", FALSE, NULL));
|
||||||
|
GtkWidget *website;
|
||||||
|
GtkWidget *license;
|
||||||
|
GtkWidget *close;
|
||||||
|
GtkWidget *actions;
|
||||||
|
GList *children;
|
||||||
|
GList *child;
|
||||||
static const gchar *empty_people[] = { NULL };
|
static const gchar *empty_people[] = { NULL };
|
||||||
theme_manager_attach_window (GTK_WIDGET (dialog));
|
theme_manager_attach_window (GTK_WIDGET (dialog));
|
||||||
char comment[512];
|
char comment[512];
|
||||||
@@ -1984,12 +1965,20 @@ menu_about (GtkWidget *wid, gpointer sess)
|
|||||||
gtk_about_dialog_set_logo (dialog, pix_zoitechat);
|
gtk_about_dialog_set_logo (dialog, pix_zoitechat);
|
||||||
gtk_about_dialog_set_copyright (dialog, "\302\251 1998-2010 Peter \305\275elezn\303\275\n\302\251 2009-2014 Berke Viktor\n\302\251 2015-2025 Patrick Griffis\n\302\251 2026 deepend");
|
gtk_about_dialog_set_copyright (dialog, "\302\251 1998-2010 Peter \305\275elezn\303\275\n\302\251 2009-2014 Berke Viktor\n\302\251 2015-2025 Patrick Griffis\n\302\251 2026 deepend");
|
||||||
gtk_about_dialog_set_comments (dialog, comment);
|
gtk_about_dialog_set_comments (dialog, comment);
|
||||||
about_dialog_strip_actions (GTK_DIALOG (dialog));
|
actions = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
|
||||||
about_dialog_add_links (dialog);
|
children = gtk_container_get_children (GTK_CONTAINER (actions));
|
||||||
gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Close"), GTK_RESPONSE_CLOSE);
|
for (child = children; child; child = child->next)
|
||||||
|
gtk_widget_destroy (GTK_WIDGET (child->data));
|
||||||
|
g_list_free (children);
|
||||||
|
website = gtk_dialog_add_button (GTK_DIALOG (dialog), "Website", GTK_RESPONSE_HELP);
|
||||||
|
license = gtk_dialog_add_button (GTK_DIALOG (dialog), "License", GTK_RESPONSE_APPLY);
|
||||||
|
close = gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Close"), GTK_RESPONSE_CLOSE);
|
||||||
|
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (actions), website, TRUE);
|
||||||
|
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (actions), license, TRUE);
|
||||||
|
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (actions), close, FALSE);
|
||||||
|
|
||||||
gtk_window_set_transient_for (GTK_WINDOW(dialog), GTK_WINDOW(parent_window));
|
gtk_window_set_transient_for (GTK_WINDOW(dialog), GTK_WINDOW(parent_window));
|
||||||
g_signal_connect (G_OBJECT(dialog), "response", G_CALLBACK(about_dialog_close), NULL);
|
g_signal_connect (G_OBJECT(dialog), "response", G_CALLBACK(about_dialog_response), NULL);
|
||||||
g_signal_connect (G_OBJECT(dialog), "activate-link", G_CALLBACK(about_dialog_openurl), NULL);
|
g_signal_connect (G_OBJECT(dialog), "activate-link", G_CALLBACK(about_dialog_openurl), NULL);
|
||||||
|
|
||||||
gtk_widget_show_all (GTK_WIDGET(dialog));
|
gtk_widget_show_all (GTK_WIDGET(dialog));
|
||||||
|
|||||||
@@ -1406,55 +1406,20 @@ theme_preferences_gtk3_changed_cb (GtkComboBox *combo, gpointer user_data)
|
|||||||
static GdkPixbuf *
|
static GdkPixbuf *
|
||||||
theme_preferences_load_thumbnail (const char *path)
|
theme_preferences_load_thumbnail (const char *path)
|
||||||
{
|
{
|
||||||
char *data = NULL;
|
|
||||||
gsize length = 0;
|
|
||||||
GdkPixbufLoader *loader;
|
|
||||||
GError *error = NULL;
|
GError *error = NULL;
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
GdkPixbuf *scaled;
|
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
|
|
||||||
if (!path || !g_file_get_contents (path, &data, &length, &error))
|
if (!path)
|
||||||
{
|
|
||||||
g_clear_error (&error);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
loader = gdk_pixbuf_loader_new ();
|
pixbuf = gdk_pixbuf_new_from_file_at_scale (path, 48, 48, TRUE, &error);
|
||||||
if (!gdk_pixbuf_loader_write (loader, (const guchar *) data, length, &error))
|
|
||||||
{
|
|
||||||
g_clear_error (&error);
|
|
||||||
g_object_unref (loader);
|
|
||||||
g_free (data);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (data);
|
|
||||||
|
|
||||||
if (!gdk_pixbuf_loader_close (loader, &error))
|
|
||||||
{
|
|
||||||
g_clear_error (&error);
|
|
||||||
g_object_unref (loader);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
|
|
||||||
if (!pixbuf)
|
if (!pixbuf)
|
||||||
{
|
{
|
||||||
g_object_unref (loader);
|
g_clear_error (&error);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
width = gdk_pixbuf_get_width (pixbuf);
|
return pixbuf;
|
||||||
height = gdk_pixbuf_get_height (pixbuf);
|
|
||||||
if (width > 48 || height > 48)
|
|
||||||
scaled = gdk_pixbuf_scale_simple (pixbuf, 48, 48, GDK_INTERP_BILINEAR);
|
|
||||||
else
|
|
||||||
scaled = gdk_pixbuf_copy (pixbuf);
|
|
||||||
|
|
||||||
g_object_unref (loader);
|
|
||||||
return scaled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|||||||
Reference in New Issue
Block a user