mirror of
https://gitlab.gnome.org/GNOME/gitg
synced 2024-10-05 23:50:07 +00:00
Use native controls on OS X
This commit is contained in:
parent
423d954974
commit
871ac85e1b
22
configure.ac
22
configure.ac
|
@ -110,6 +110,28 @@ PKG_CHECK_MODULES(LIBGITG, [
|
|||
libsecret-1
|
||||
])
|
||||
|
||||
gdk_targets=`$PKG_CONFIG --variable=targets gdk-3.0`
|
||||
|
||||
for target in $gdk_targets;
|
||||
do
|
||||
case "$target" in
|
||||
quartz)
|
||||
gdk_windowing_quartz=yes
|
||||
;;
|
||||
win32)
|
||||
gdk_windowing_win32=yes
|
||||
;;
|
||||
x11)
|
||||
gdk_windowing_x11=yes
|
||||
esac
|
||||
done
|
||||
|
||||
AM_CONDITIONAL(GDK_WINDOWING_X11, test "$gdk_windowing_x11" = "yes")
|
||||
AM_CONDITIONAL(GDK_WINDOWING_QUARTZ, test "$gdk_windowing_quartz" = "yes")
|
||||
AM_CONDITIONAL(GDK_WINDOWING_WIN32, test "$gdk_windowing_win32" = "yes")
|
||||
|
||||
AC_PROG_OBJC
|
||||
|
||||
AC_MSG_CHECKING([for libgit2-glib threading support])
|
||||
|
||||
cflags_save="${CFLAGS}"
|
||||
|
|
|
@ -26,6 +26,7 @@ gitg_gitg_VALAFLAGS = \
|
|||
--pkg gd-1.0 \
|
||||
--pkg gtksourceview-3.0 \
|
||||
--pkg GtkSpell-3.0 \
|
||||
--pkg gitg-platform-support \
|
||||
--girdir "$(top_builddir)/libgd" \
|
||||
--girdir "$(top_builddir)" \
|
||||
--vapidir "$(top_srcdir)/vapi" \
|
||||
|
|
|
@ -57,6 +57,9 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
|
|||
[GtkChild]
|
||||
private Gtk.Grid d_grid_main;
|
||||
|
||||
[GtkChild]
|
||||
private Gtk.Grid d_grid_top;
|
||||
|
||||
[GtkChild]
|
||||
private Gtk.ToggleButton d_select_button;
|
||||
[GtkChild]
|
||||
|
@ -188,6 +191,12 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
|
|||
|
||||
construct
|
||||
{
|
||||
if (Gitg.PlatformSupport.use_native_window_controls())
|
||||
{
|
||||
set_titlebar(null);
|
||||
d_grid_top.attach(d_header_bar, 0, 0, 1, 1);
|
||||
}
|
||||
|
||||
add_action_entries(win_entries, this);
|
||||
|
||||
d_notifications = new Notifications(d_overlay);
|
||||
|
@ -365,26 +374,26 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
|
|||
|
||||
private void update_title()
|
||||
{
|
||||
string windowtitle = "gitg";
|
||||
string title;
|
||||
string? subtitle = null;
|
||||
|
||||
if (d_repository != null)
|
||||
{
|
||||
// set title
|
||||
File? workdir = d_repository.get_workdir();
|
||||
string name;
|
||||
|
||||
if (workdir != null)
|
||||
{
|
||||
var parent_path = Utils.replace_home_dir_with_tilde(workdir.get_parent());
|
||||
|
||||
name = @"$(d_repository.name) ($parent_path)";
|
||||
title = @"$name - gitg";
|
||||
title = @"$(d_repository.name) ($parent_path)";
|
||||
windowtitle = @"$name - gitg";
|
||||
}
|
||||
else
|
||||
{
|
||||
name = d_repository.name;
|
||||
title = d_repository.name;
|
||||
}
|
||||
|
||||
d_header_bar.set_title(name);
|
||||
|
||||
string? head_name = null;
|
||||
|
||||
try
|
||||
|
@ -396,19 +405,25 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
|
|||
|
||||
if (head_name != null)
|
||||
{
|
||||
d_header_bar.set_subtitle(Markup.escape_text(head_name));
|
||||
}
|
||||
else
|
||||
{
|
||||
d_header_bar.set_subtitle(null);
|
||||
subtitle = Markup.escape_text(head_name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
title = "gitg";
|
||||
title = _("Projects");
|
||||
}
|
||||
|
||||
d_header_bar.set_title(_("Projects"));
|
||||
d_header_bar.set_subtitle(null);
|
||||
if (Gitg.PlatformSupport.use_native_window_controls())
|
||||
{
|
||||
d_header_bar.set_title(subtitle);
|
||||
this.title = title;
|
||||
}
|
||||
else
|
||||
{
|
||||
d_header_bar.set_title(title);
|
||||
d_header_bar.set_subtitle(subtitle);
|
||||
|
||||
this.title = windowtitle;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,10 +14,7 @@
|
|||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="vexpand">False</property>
|
||||
<property name="show_close_button">True</property>
|
||||
<style>
|
||||
<class name="titlebar"/>
|
||||
</style>
|
||||
<property name="show_close_button">False</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="d_dash_button">
|
||||
<property name="visible">False</property>
|
||||
|
@ -130,130 +127,142 @@
|
|||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkOverlay" id="d_overlay">
|
||||
<object class="GtkGrid" id="d_grid_top">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="d_grid_main">
|
||||
<object class="GtkOverlay" id="d_overlay">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="d_infobar_placeholder">
|
||||
<object class="GtkGrid" id="d_grid_main">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkInfoBar" id="d_infobar">
|
||||
<property name="visible">False</property>
|
||||
<child internal-child="content_area">
|
||||
<object class="GtkBox" id="infobar_content_area">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">8</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">16</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="d_infobar_primary_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="selectable">True</property>
|
||||
<property name="use-markup">True</property>
|
||||
<property name="halign">GTK_ALIGN_START</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="d_infobar_secondary_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="selectable">True</property>
|
||||
<property name="use-markup">True</property>
|
||||
<property name="halign">GTK_ALIGN_START</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="infobar_action_area">
|
||||
<object class="GtkBox" id="d_infobar_placeholder">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">horizontal</property>
|
||||
<child>
|
||||
<object class="GtkInfoBar" id="d_infobar">
|
||||
<property name="visible">False</property>
|
||||
<child internal-child="content_area">
|
||||
<object class="GtkBox" id="infobar_content_area">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="border_width">8</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="layout_style">end</property>
|
||||
<property name="spacing">16</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="d_infobar_close_button">
|
||||
<object class="GtkLabel" id="d_infobar_primary_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Close</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="selectable">True</property>
|
||||
<property name="use-markup">True</property>
|
||||
<property name="halign">GTK_ALIGN_START</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="d_infobar_secondary_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="selectable">True</property>
|
||||
<property name="use-markup">True</property>
|
||||
<property name="halign">GTK_ALIGN_START</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="infobar_action_area">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">5</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<property name="layout_style">end</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="d_infobar_close_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Close</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="-6">d_infobar_close_button</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
</child>
|
||||
<action-widgets>
|
||||
<action-widget response="-6">d_infobar_close_button</action-widget>
|
||||
</action-widgets>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSearchBar" id="d_search_bar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="show-close-button">False</property>
|
||||
<child>
|
||||
<object class="GdTaggedEntry" id="d_search_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="invisible_char_set">True</property>
|
||||
<property name="width-request">500</property>
|
||||
<signal name="changed" handler="search_entry_changed" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="d_main_stack">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<child>
|
||||
<object class="GitgDashView" id="d_dash_view">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="d_stack_activities">
|
||||
<object class="GtkSearchBar" id="d_search_bar">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="show-close-button">False</property>
|
||||
<child>
|
||||
<object class="GdTaggedEntry" id="d_search_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="invisible_char_set">True</property>
|
||||
<property name="width-request">500</property>
|
||||
<signal name="changed" handler="search_entry_changed" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="d_main_stack">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<child>
|
||||
<object class="GitgDashView" id="d_dash_view">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="d_stack_activities">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
|
|
@ -21,6 +21,11 @@ libgitg_libgitg_1_0_la_LDFLAGS = \
|
|||
libgitg_libgitg_1_0_la_LIBADD = \
|
||||
$(LIBGITG_LIBS)
|
||||
|
||||
if GDK_WINDOWING_QUARTZ
|
||||
libgitg_libgitg_1_0_la_LIBADD += -lobjc
|
||||
libgitg_libgitg_1_0_la_CFLAGS += -xobjective-c
|
||||
endif
|
||||
|
||||
libgitg_libgitg_1_0_la_VALAFLAGS = \
|
||||
--pkg ggit-1.0 \
|
||||
--pkg gtk+-3.0 \
|
||||
|
@ -31,6 +36,7 @@ libgitg_libgitg_1_0_la_VALAFLAGS = \
|
|||
--pkg gdesktop-enums-3.0 \
|
||||
--pkg libsoup-2.4 \
|
||||
--pkg gtksourceview-3.0 \
|
||||
--pkg gitg-platform-support \
|
||||
$(GITG_VALAFLAGS) \
|
||||
--vapidir $(top_srcdir)/vapi \
|
||||
--includedir libgitg \
|
||||
|
@ -82,11 +88,14 @@ libgitg_libgitg_1_0_la_VALASOURCES = \
|
|||
|
||||
libgitg_libgitg_1_0_la_SOURCES = \
|
||||
$(libgitg_libgitg_1_0_la_VALASOURCES) \
|
||||
libgitg/gitg-platform-support.c \
|
||||
libgitg/gitg-resources.c
|
||||
|
||||
libgitg_libgitg_1_0_la_headerdir = $(prefix)/include/libgitg-1.0/libgitg
|
||||
libgitg_libgitg_1_0_la_header_HEADERS = libgitg/libgitg.h
|
||||
|
||||
noinst_HEADERS += libgitg/gitg-platform-support.h
|
||||
|
||||
libgitg_libgitg_1_0_la_vapidir = $(prefix)/share/vala/vapi
|
||||
libgitg_libgitg_1_0_la_vapi_DATA = libgitg/libgitg-1.0.vapi
|
||||
|
||||
|
|
20
libgitg/gitg-platform-support.c
Normal file
20
libgitg/gitg-platform-support.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include "gitg-platform-support.h"
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#include <gdk/gdkquartz.h>
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
gitg_platform_support_use_native_window_controls (GdkDisplay *display)
|
||||
{
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
if (display == NULL)
|
||||
{
|
||||
display = gdk_display_get_default ();
|
||||
}
|
||||
|
||||
return GDK_IS_QUARTZ_DISPLAY (display);
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
9
libgitg/gitg-platform-support.h
Normal file
9
libgitg/gitg-platform-support.h
Normal file
|
@ -0,0 +1,9 @@
|
|||
#ifndef __GITG_PLATFORM_SUPPORT_H__
|
||||
#define __GITG_PLATFORM_SUPPORT_H__
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
gboolean gitg_platform_support_use_native_window_controls (GdkDisplay *display);
|
||||
|
||||
#endif /* __GITG_PLATFORM_SUPPORT_H__ */
|
||||
|
9
vapi/gitg-platform-support.vapi
Normal file
9
vapi/gitg-platform-support.vapi
Normal file
|
@ -0,0 +1,9 @@
|
|||
[CCode(cheader_filename = "libgitg/gitg-platform-support.h")]
|
||||
namespace Gitg
|
||||
{
|
||||
[CCode(cprefix = "GitgPlatformSupport", lower_case_cprefix = "gitg_platform_support_")]
|
||||
public class PlatformSupport
|
||||
{
|
||||
public static bool use_native_window_controls(Gdk.Display? display = null);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue